[Formed-commits] r344 - in trunk: . formed/formed/plugins/export

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 11 16:17:01 CET 2010


Author: frank
Date: 2010-03-11 16:16:58 +0100 (Thu, 11 Mar 2010)
New Revision: 344

Modified:
   trunk/ChangeLog
   trunk/formed/formed/plugins/export/xls.py
Log:
Allow groups in choices.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-12-02 10:42:29 UTC (rev 343)
+++ trunk/ChangeLog	2010-03-11 15:16:58 UTC (rev 344)
@@ -1,3 +1,7 @@
+2010-02-11	Frank Koormann <frank.koormann at intevation.de>
+
+	* formed/formed/plugins/export/xls.py: Allow groups in choices.
+
 2009-12-02	Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* formed/formed/plugins/export/typemap.py: do not ignore conditional

Modified: trunk/formed/formed/plugins/export/xls.py
===================================================================
--- trunk/formed/formed/plugins/export/xls.py	2009-12-02 10:42:29 UTC (rev 343)
+++ trunk/formed/formed/plugins/export/xls.py	2010-03-11 15:16:58 UTC (rev 344)
@@ -221,22 +221,21 @@
             return
 
         kvs = {}
-        keys_values = []
+        stack = choice.children[:]
         try:
-            for c in choice.children:
+            while stack:
+                c = stack.pop()
                 if isinstance(c, data.ExternalChoiceListLeaf):
                     cc = c.getChildren()
-                    if cc:
-                        for ccc in cc:
-                            desc = ccc.getDescription()
-                            if not desc: desc = ""
-                            kvs[int(ccc.getValue())] = desc
+                    if cc: stack.extend(cc)
+                elif isinstance(c, data.GroupNode):
+                    stack.extend(c.children)
                 elif isinstance(c, data.BoolLeaf):
                     desc = c.getDescription()
                     if not desc: desc = ""
                     kvs[int(c.getValue())] = desc
         except ValueError:
-            print >> sys.stderr, "WARNING: choice '%s' contains none integer values" % choice.getName()
+            print >> sys.stderr, "WARNING: Choice '%s' contains no integer values" % name
             return
 
         if not kvs:



More information about the Formed-commits mailing list