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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 13 17:27:50 CET 2009


Author: teichmann
Date: 2009-11-13 17:27:49 +0100 (Fri, 13 Nov 2009)
New Revision: 341

Modified:
   trunk/ChangeLog
   trunk/formed/formed/plugins/export/typemap.py
Log:
Fixed python dictionary exporter to work with new repeat group structure.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-28 16:31:02 UTC (rev 340)
+++ trunk/ChangeLog	2009-11-13 16:27:49 UTC (rev 341)
@@ -1,3 +1,8 @@
+2009-11-13	Sascha L. Teichmann <teichmann at intevation.de>
+
+	* formed/formed/plugins/export/typemap.py: Fixed to work
+	with new repeat group nodes.
+
 2009-10-28	Sascha L. Teichmann <teichmann at intevation.de>
 
 	* formed/formed/plugins/export/xsd.py,

Modified: trunk/formed/formed/plugins/export/typemap.py
===================================================================
--- trunk/formed/formed/plugins/export/typemap.py	2009-10-28 16:31:02 UTC (rev 340)
+++ trunk/formed/formed/plugins/export/typemap.py	2009-11-13 16:27:49 UTC (rev 341)
@@ -73,16 +73,19 @@
         self.all_relations = []
 
     @checkMode
-    def _matchGroup(self, node):
-        if node.isRepeat():
-            name = node.getName().replace("rg_", "", 1)
-            self.stack.append(Relation(name))
+    def _matchRepeat(self, node):
+        name = node.getName().replace("rg_", "", 1)
+        self.stack.append(Relation(name))
 
         for nc in node.children:
             self._handleChild(nc)
 
-        if node.isRepeat():
-            self.all_relations.append(self.stack.pop())
+        self.all_relations.append(self.stack.pop())
+
+    @checkMode
+    def _matchGroup(self, node):
+        for nc in node.children:
+            self._handleChild(nc)
     
     @checkMode
     def _matchText(self, nc):
@@ -112,8 +115,11 @@
     def _matchInt(self, nc):
         self.stack[-1].append((nc.getName(), '_int_converter'))
 
+    @checkMode
     def _handleChild(self, nc):
-        if isinstance(nc, data.GroupNode):
+        if isinstance(nc, data.RepeatNode):
+            self._matchRepeat(nc)
+        elif isinstance(nc, data.GroupNode):
             self._matchGroup(nc)
         elif isinstance(nc, data.RadioNode):
             self._matchRadio(nc)
@@ -171,7 +177,7 @@
 
     def doExport(self, path, main, dummy):
         document = main.getDocument()
-        root     = document.root
+        root     = document.getCase()
         mode     = main.getSelectedMode()
         allModes = main.getAllModes()
         out      = None



More information about the Formed-commits mailing list