[Mpuls-commits] r3403 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Aug 13 17:18:12 CEST 2010


Author: torsten
Date: 2010-08-13 17:18:11 +0200 (Fri, 13 Aug 2010)
New Revision: 3403

Modified:
   base/trunk/mpulsweb/lib/helpers.py
Log:
* mpulsweb/lib/helpers.py (render_logbook_typeoptions): Added new
function to render the options for the different logbook type based on
the configuration.


Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py	2010-08-13 15:16:57 UTC (rev 3402)
+++ base/trunk/mpulsweb/lib/helpers.py	2010-08-13 15:18:11 UTC (rev 3403)
@@ -131,8 +131,18 @@
         out.append(">")
     return "".join(out)
 
+def render_logbook_typeoptions(item):
+    out = []
+    for i in item.get('options'):
+        if isinstance(i, dict):
+            out.append('<optgroup label="%s">' % i.get('label'))
+            out.extend(render_logbook_typeoptions(i))
+            out.append('</optgroup>')
+        else:
+            out.append('<option value="%s">%s</option>' % (i[0], i[1]))
+    print out
+    return out
 
-
 # Helper functions used in the UI to show some information like status messages
 # or icons
 



More information about the Mpuls-commits mailing list