[Mpuls-commits] r5991 - base/trunk/mpulsweb/controllers

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu Jun 21 14:46:21 CEST 2012


Author: bricks
Date: 2012-06-21 14:46:21 +0200 (Thu, 21 Jun 2012)
New Revision: 5991

Modified:
   base/trunk/mpulsweb/controllers/case.py
Log:
Allow to get an xml importer by reading the file

This is necessary to get different importers for
different formed versions.


Modified: base/trunk/mpulsweb/controllers/case.py
===================================================================
--- base/trunk/mpulsweb/controllers/case.py	2012-06-15 13:54:14 UTC (rev 5990)
+++ base/trunk/mpulsweb/controllers/case.py	2012-06-21 12:46:21 UTC (rev 5991)
@@ -605,7 +605,7 @@
         a custom validator'''
         return NewCaseForm()
 
-    def _get_xmlimporter(self):
+    def _get_xmlimporter(self, xmlfile):
         '''This function should be overwritten in specific applications to add
         a custom XML Importer'''
         allow_documents = g.mpuls_config.is_enabled('case-module', 'documents')
@@ -706,10 +706,9 @@
     @checkRole('cm')
     def importXMLAction(self):
         try:
-            importer = self._get_xmlimporter()
-
             xmlfile = request.POST['xmlfile']
             try:
+                importer = self._get_xmlimporter(xmlfile.file)
                 importer.import_xml(PostgresDBInterface(), xmlfile.file)
             finally:
                 xmlfile.file.close()



More information about the Mpuls-commits mailing list