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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Oct 28 17:31:02 CET 2009


Author: teichmann
Date: 2009-10-28 17:31:02 +0100 (Wed, 28 Oct 2009)
New Revision: 340

Modified:
   trunk/ChangeLog
   trunk/formed/formed/plugins/export/new_sql.py
   trunk/formed/formed/plugins/export/sql.py
   trunk/formed/formed/plugins/export/xsd.py
Log:
Allow groups in choices


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-07 14:02:00 UTC (rev 339)
+++ trunk/ChangeLog	2009-10-28 16:31:02 UTC (rev 340)
@@ -1,3 +1,9 @@
+2009-10-28	Sascha L. Teichmann <teichmann at intevation.de>
+
+	* formed/formed/plugins/export/xsd.py,
+	formed/formed/plugins/export/sql.py,
+	formed/formed/plugins/export/new_sql.py: Allow groups in choices.
+
 2009-10-07	Frank Koormann <frank.koormann at intevation.de>
 
 	* formed/formed/plugins/export/latex.py:

Modified: trunk/formed/formed/plugins/export/new_sql.py
===================================================================
--- trunk/formed/formed/plugins/export/new_sql.py	2009-10-07 14:02:00 UTC (rev 339)
+++ trunk/formed/formed/plugins/export/new_sql.py	2009-10-28 16:31:02 UTC (rev 340)
@@ -414,15 +414,15 @@
         #       return   
 
         kvs = {}
+        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 = ""

Modified: trunk/formed/formed/plugins/export/sql.py
===================================================================
--- trunk/formed/formed/plugins/export/sql.py	2009-10-07 14:02:00 UTC (rev 339)
+++ trunk/formed/formed/plugins/export/sql.py	2009-10-28 16:31:02 UTC (rev 340)
@@ -414,15 +414,15 @@
         #       return   
 
         kvs = {}
+        stack = choice.children[:]
         try:
-            for c in choice.children:
+            while stack:
+                current = 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 = ""

Modified: trunk/formed/formed/plugins/export/xsd.py
===================================================================
--- trunk/formed/formed/plugins/export/xsd.py	2009-10-07 14:02:00 UTC (rev 339)
+++ trunk/formed/formed/plugins/export/xsd.py	2009-10-28 16:31:02 UTC (rev 340)
@@ -376,22 +376,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 none integer values" % name
             return
 
         if not kvs:



More information about the Formed-commits mailing list