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

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


Author: bh
Date: 2011-11-18 19:57:19 +0100 (Fri, 18 Nov 2011)
New Revision: 5614

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
Extract the postprocessing after an XML import into a separate method.
The postprocessing already present in MPulsXMLImporter.import_xml was
extended to cover more than just the tagging in revision
5599. Unfortunately this broke the meta API server. By putting the
postprocessing into a separate method it can be easily overwritten by
the API server. That it also structures the code better, doesn't hurt,
though.


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-11-18 17:18:30 UTC (rev 5613)
+++ base/trunk/mpulsweb/model/case.py	2011-11-18 18:57:19 UTC (rev 5614)
@@ -1550,6 +1550,19 @@
         # If there were any errors, an XMLImportException will have been
         # raised and the DB changes will have been rolled back and no further
         # handling of the imported cases will be necessary anyway.
+        self.postprocess_imported_cases()
+
+    def postprocess_imported_cases(self):
+        """Apply various postprocessing functions to the imported case.
+        Called after successfully importing all cases. The method can
+        use self.imported_ids as a list with the ids of the newly
+        imported or modified cases.
+
+        The default implementation handles automatic phase changes if
+        they are configured and triggers tagging on all the imported
+        cases. Derived classes may extend or override this method to
+        change this.
+        """
         changemode = g.mpuls_config.get('phases', 'changemode')
         if changemode != PC_MANUAL: 
             # Trigger setting max phase after importing when changemode is not



More information about the Mpuls-commits mailing list