[Mpuls-commits] r4490 - in base/trunk: . mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 11 21:53:57 CET 2011


Author: bh
Date: 2011-01-11 21:53:56 +0100 (Tue, 11 Jan 2011)
New Revision: 4490

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/logbook.py
Log:
Adapt to libformed revision 275:f922623c6b08

* mpulsweb/model/logbook.py (new_node): New. Helper function for
get_logbook_import_factory
(get_logbook_import_factory): Adapt to libformed revision
275:f922623c6b08 which now requires sequences instead of
dictionaries in the StructureNode constructor.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-01-11 13:51:48 UTC (rev 4489)
+++ base/trunk/ChangeLog	2011-01-11 20:53:56 UTC (rev 4490)
@@ -1,3 +1,13 @@
+2011-01-11  Bernhard Herzog  <bh at intevation.de>
+
+	Adapt to libformed revision 275:f922623c6b08
+
+	* mpulsweb/model/logbook.py (new_node): New. Helper function for
+	get_logbook_import_factory
+	(get_logbook_import_factory): Adapt to libformed revision
+	275:f922623c6b08 which now requires sequences instead of
+	dictionaries in the StructureNode constructor.
+
 2011-01-11  Roland Geider <roland.geider at intevation.de>
 
 	* mpulsweb/public/styles/screen.css: issue1658: Move bullet list for

Modified: base/trunk/mpulsweb/model/logbook.py
===================================================================
--- base/trunk/mpulsweb/model/logbook.py	2011-01-11 13:51:48 UTC (rev 4489)
+++ base/trunk/mpulsweb/model/logbook.py	2011-01-11 20:53:56 UTC (rev 4490)
@@ -35,7 +35,7 @@
 
 from pylons import app_globals as g
 
-import formed.meta.data as data
+from formed.meta.data import RepeatNode, TextLeaf, IntLeaf
 from formed.meta.structure import StructureNode
 from formed.instance.backends.xmlimport import ComponentFactory
 from formed.instance.simplified import StructureInstanceNode, \
@@ -463,24 +463,26 @@
         text_subelement(entry_element, "tagebuch-typ", entry.typ)
 
 
+def new_node(cls, name):
+    node = cls()
+    node.setName(name)
+    return node
+
 def get_logbook_import_factory():
     """Return the component factory for the logbook for the libformed xmlimport
     """
-    meta_node = data.RepeatNode()
-    meta_node.setName("tagebuch-eintrag")
-    entry_node = StructureNode(meta_node,
-                               {"tagebuch-datum": data.TextLeaf(),
-                                "tagebuch-bearbeiter": data.TextLeaf(),
-                                "tagebuch-art": data.IntLeaf(),
-                                "tagebuch-sonstiges": data.TextLeaf(),
-                                "tagebuch-notiz": data.TextLeaf(),
-                                "tagebuch-dauer": data.IntLeaf(),
-                                "tagebuch-typ": data.IntLeaf(),
-                                },
-                               {})
+    entry_node = StructureNode(new_node(RepeatNode, "tagebuch-eintrag"),
+                               [new_node(TextLeaf, "tagebuch-datum"),
+                                new_node(TextLeaf, "tagebuch-bearbeiter"),
+                                new_node(IntLeaf, "tagebuch-art"),
+                                new_node(TextLeaf, "tagebuch-sonstiges"),
+                                new_node(TextLeaf, "tagebuch-notiz"),
+                                new_node(IntLeaf, "tagebuch-dauer"),
+                                new_node(IntLeaf, "tagebuch-typ"),
+                                ],
+                               [])
     return ComponentFactory(None,
-                            StructureNode(None, {},
-                                          {"tagebuch-eintrag": entry_node}),
+                            StructureNode(None, [], [entry_node]),
                             StructureInstanceNode,
                             StructureInstanceTree)
 



More information about the Mpuls-commits mailing list