[Mpuls-commits] r3610 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 13 17:32:08 CEST 2010


Author: bh
Date: 2010-09-13 17:32:07 +0200 (Mon, 13 Sep 2010)
New Revision: 3610

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/case_bundle.py
Log:
* mpulsweb/controllers/case_bundle.py
(CaseBundleController.bundleAction): Combine the various export
cases into one if-block.  Apart from the format parameter in the
export method call they were identical.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-13 15:29:51 UTC (rev 3609)
+++ base/trunk/ChangeLog	2010-09-13 15:32:07 UTC (rev 3610)
@@ -1,3 +1,10 @@
+2010-09-13  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/controllers/case_bundle.py
+	(CaseBundleController.bundleAction): Combine the various export
+	cases into one if-block.  Apart from the format parameter in the
+	export method call they were identical.
+
 2010-09-13  Roland Geider <roland.geider at intevation.de>
 
 	* mpulsweb/lib/renderer.py: issue1147: incorrect handling of UTF-8

Modified: base/trunk/mpulsweb/controllers/case_bundle.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_bundle.py	2010-09-13 15:29:51 UTC (rev 3609)
+++ base/trunk/mpulsweb/controllers/case_bundle.py	2010-09-13 15:32:07 UTC (rev 3610)
@@ -158,36 +158,17 @@
 
                 return render('/casebundle/editor.mako')
 
-            if action == 'exportXML':
-                # Fiter out case which are not open(1) or inavtice (2)
+            if action.startswith("export"):
                 user = session['USER_AUTHORIZED']
                 case_bundle = self._filterBundle(case_bundle, (1, 2))
                 if case_bundle.isEmpty():
                     return self._empty_caselist()
                 session['casebundle'] = case_bundle
                 session.save()
-                return self.export('XML')
+                export_format = action[6:]
+                if export_format in ("XML", "CSV", "XLS"):
+                    return self.export(export_format)
 
-            if action == 'exportCSV':
-                # Fiter out case which are not open(1) or inavtice (2)
-                user = session['USER_AUTHORIZED']
-                case_bundle = self._filterBundle(case_bundle, (1, 2))
-                if case_bundle.isEmpty():
-                    return self._empty_caselist()
-                session['casebundle'] = case_bundle
-                session.save()
-                return self.export('CSV')
-
-            if action == 'exportXLS':
-                # Fiter out case which are not open(1) or inavtice (2)
-                user = session['USER_AUTHORIZED']
-                case_bundle = self._filterBundle(case_bundle, (1, 2))
-                if case_bundle.isEmpty():
-                    return self._empty_caselist()
-                session['casebundle'] = case_bundle
-                session.save()
-                return self.export('XLS')
-
         except formencode.Invalid, error:
             log.exception(error)
             raise



More information about the Mpuls-commits mailing list