[Mpuls-commits] r2558 - in wasko/branches/2.0: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 29 12:18:57 CEST 2010


Author: roland
Date: 2010-04-29 12:18:56 +0200 (Thu, 29 Apr 2010)
New Revision: 2558

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/lib/renderer.py
Log:
Wald issue #1366: sort dropdowns using 'target' as key

Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-04-29 10:16:14 UTC (rev 2557)
+++ wasko/branches/2.0/ChangeLog	2010-04-29 10:18:56 UTC (rev 2558)
@@ -6,6 +6,8 @@
 
 2010-04-29  Roland Geider <roland.geider at intevation.de>
 	* jmdweb/templates/main.mako: additional filter in list comprehension
+	* mpulsweb/lib/renderer.py: Wald issue #1366: sort dropdowns using their
+        "target" as key
 
 2010-04-28  Torsten Irländer <torsten.irlaender at intevation.de>
 

Modified: wasko/branches/2.0/mpulsweb/lib/renderer.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-04-29 10:16:14 UTC (rev 2557)
+++ wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-04-29 10:18:56 UTC (rev 2558)
@@ -839,12 +839,14 @@
 
     def _renderExternalChoiceList(self, choiceList):
         out = []
-        children = choiceList.getChildren()
+        children = sorted(choiceList.getChildren(), key = lambda child: child.getTarget())
+        
         if children:
             for child in children:
                 value = child.getValue()
-                out.append(tag("option", value=value,
-                               selected=(value == self.stateStack[-1])))
+                out.append(tag("option",
+                               value    = value,
+                               selected = (value == self.stateStack[-1])))
                 out.append(escape(child.getDescription()))
                 out.append("</option>")
         self.toTarget(Text("\n".join(out)),



More information about the Mpuls-commits mailing list