[Mpuls-commits] r5861 - base/trunk/mpulsweb/model

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 7 10:14:21 CET 2012


Author: ludwig
Date: 2012-03-07 10:14:21 +0100 (Wed, 07 Mar 2012)
New Revision: 5861

Modified:
   base/trunk/mpulsweb/model/document.py
Log:
Issue 2682: Use add_leaf to the xml export of documents.
add_leaf should have a better converting.


Modified: base/trunk/mpulsweb/model/document.py
===================================================================
--- base/trunk/mpulsweb/model/document.py	2012-03-06 14:22:51 UTC (rev 5860)
+++ base/trunk/mpulsweb/model/document.py	2012-03-07 09:14:21 UTC (rev 5861)
@@ -40,6 +40,7 @@
 from formed.meta.data import RepeatNode, TextLeaf, DateLeaf
 from formed.meta.structure import StructureNode
 from formed.instance.backends.xmlimport import ComponentFactory
+from formed.instance.backends.xmlexport import add_leaf
 from formed.instance.simplified import StructureInstanceNode, \
      StructureInstanceTree
 
@@ -372,14 +373,12 @@
     for document in listDocuments(case_id):
         document.load(True)
         document_element = ET.SubElement(documents_element, "anlage")
-        text_subelement(document_element, "anlage-mime", document.mime)
-        text_subelement(document_element, "anlage-name", document.name)
-        text_subelement(document_element, "anlage-daten",
-                        base64.b64encode(document.data))
-        text_subelement(document_element, "anlage-beschreibung",
-                        document.description)
-        text_subelement(document_element, "anlage-datum",
-                        document.insert_date)  
+        add_leaf(document_element, "anlage-mime", document.mime)
+        add_leaf(document_element, "anlage-name", document.name)
+        add_leaf(document_element, "anlage-daten",
+                 base64.b64encode(document.data))
+        add_leaf(document_element, "anlage-beschreibung", document.description)
+        add_leaf(document_element, "anlage-datum", document.insert_date)
 
 def get_documents_import_factory():
     """Return component factory for documents for libformed xmlimport"""



More information about the Mpuls-commits mailing list