[Mpuls-commits] r100 - in waska/trunk: . waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Aug 28 12:30:32 CEST 2008


Author: teichmann
Date: 2008-08-28 12:30:32 +0200 (Thu, 28 Aug 2008)
New Revision: 100

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/lib/needed.py
Log:
Phase: open help in a new window and display none emty help.


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-08-28 09:35:11 UTC (rev 99)
+++ waska/trunk/ChangeLog.txt	2008-08-28 10:30:32 UTC (rev 100)
@@ -1,5 +1,10 @@
 2008-08-28  Sascha L. Teichmann <sascha.teichmann at intevation.de>
 
+	* waskaweb/lib/needed.py: Open help in new window. using parent's
+	  description if description of item is empty.
+
+2008-08-28  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
 	* waskaweb/lib/needed.py: Handle the case that a data base field 
 	  has no default value correctly.
 

Modified: waska/trunk/waskaweb/lib/needed.py
===================================================================
--- waska/trunk/waskaweb/lib/needed.py	2008-08-28 09:35:11 UTC (rev 99)
+++ waska/trunk/waskaweb/lib/needed.py	2008-08-28 10:30:32 UTC (rev 100)
@@ -44,6 +44,16 @@
     u'datum_ende_beratung',
     u'foerderbedarf'])
 
+def description(nc):
+    p = nc
+    while p:
+        desc = p.getDescription()
+        if desc:
+            desc = desc.strip()
+            if desc: return desc
+        p = p.parent
+    return nc.getName()
+
 class RequiredFields:
 
     def __init__(self):
@@ -77,7 +87,7 @@
                 v.append(a)
 
         for v in phases.itervalues():
-            v.sort(cmp=lambda a, b: cmp(a[0].getDescription(), b[0].getDescription()))
+            v.sort(cmp=lambda a, b: cmp(description(a[0]), description(b[0])))
 
         #for k in sorted(phases.iterkeys()):
         #    print >> sys.stderr, "phase '%s': %s" % (
@@ -94,7 +104,7 @@
             for l in f:
                 name = l[0].getName()
                 if name in BLACKLIST:
-                    print >> sys.stderr, "blacklist: %s" % name
+                    # print >> sys.stderr, "blacklist: %s" % name
                     continue
                 if not fields.has_key(name):
                     fields[name] = idx
@@ -122,7 +132,7 @@
             for b in a:
                 b[1] = fields.get(b[0].getName())
 
-        print >> sys.stderr, repr(self.phases.keys())
+        # print >> sys.stderr, repr(self.phases.keys())
 
         return True
 
@@ -149,7 +159,8 @@
 
         for a in phase:
             warn = (not a[1]) and ' class="required_missing"' or ""
-            link = '<a href="/case/required/%s"%s>%s</a>' % (a[0].getName(), warn, a[0].getDescription())
+            link = '<a href="/case/required/%s" target="blank"%s>%s</a>' % (
+                a[0].getName(), warn, description(a[0]))
             out.append(link)
 
         return ',\n'.join(out)



More information about the Mpuls-commits mailing list