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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 18 13:40:57 CET 2011


Author: ludwig
Date: 2011-11-18 13:40:56 +0100 (Fri, 18 Nov 2011)
New Revision: 5605

Modified:
   base/trunk/mpulsweb/lib/export.py
Log:
Issue 2620 Aenderung von 5603 Rueckgaengig gemacht.


Modified: base/trunk/mpulsweb/lib/export.py
===================================================================
--- base/trunk/mpulsweb/lib/export.py	2011-11-18 11:27:43 UTC (rev 5604)
+++ base/trunk/mpulsweb/lib/export.py	2011-11-18 12:40:56 UTC (rev 5605)
@@ -133,7 +133,7 @@
         for name, columns in table_columns.iteritems():
             extra_columns = ["id"]
             if name in repeat_groups:
-                extra_columns.append(name)
+                extra_columns.append("master_id")
             self.tables[name] = self.table_factory(titles[name],
                                                    extra_columns + columns)
             for column_name in columns:
@@ -145,20 +145,20 @@
         """Fill the tables with the contents of the ElementTree tree."""
         self.repeat_group_ids = itertools.count()
         for case_id, case in enumerate(tree.getiterator('master')):
-            self.fill_from_node(case, case_id, case_id)
+            self.fill_from_node(case, case_id)
 
-    def fill_from_node(self, node, node_id, case_id, parent_name=None):
-        rows = defaultdict(lambda: dict(id=case_id))
-        
-        if parent_name is not None:
-            rows[node.tag][parent_name] = node_id
+    def fill_from_node(self, node, node_id, parent_id=None):
+        rows = defaultdict(lambda: dict(id=node_id))
 
+        if parent_id is not None:
+            rows[node.tag]["master_id"] = parent_id
+
         for child in node.getchildren():
             name = child.tag
             nc = self.meta_tree.findByName(name)
             if isinstance(nc, RepeatNode):
                 self.fill_from_node(child, self.repeat_group_ids.next(),
-                                    case_id, name)
+                                    node_id)
             else:
                 table_name = self.field_name_to_table_name.get(name)
                 if table_name is not None:



More information about the Mpuls-commits mailing list