[Mpuls-commits] r536 - in wasko/trunk: . waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jul 7 17:48:15 CEST 2009


Author: teichmann
Date: 2009-07-07 17:48:14 +0200 (Tue, 07 Jul 2009)
New Revision: 536

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/case_overview.py
Log:
Fiexed issue322


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-06-25 08:32:54 UTC (rev 535)
+++ wasko/trunk/ChangeLog.txt	2009-07-07 15:48:14 UTC (rev 536)
@@ -1,3 +1,10 @@
+2009-07-07	Sascha L. Teichmann	<sascha.teichmann at intevation.de>
+
+	Fixed issue322
+
+	* waskaweb/controllers/case_overview.py: Enable unchecking 
+	  of parts of the case when exporting.
+
 2009-06-25	Torsten Irlaender  <torsten.irlaender at intevation.de> 
 
 	Fixed evaluation "Art der Beendigung": Values have changed for

Modified: wasko/trunk/waskaweb/controllers/case_overview.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case_overview.py	2009-06-25 08:32:54 UTC (rev 535)
+++ wasko/trunk/waskaweb/controllers/case_overview.py	2009-07-07 15:48:14 UTC (rev 536)
@@ -731,26 +731,14 @@
         page = render('casemanagement/selectParts.mako')
         return formencode.htmlfill.render(unicode(page, 'utf-8'),defaults=selection_checker.selections)
 
-    @checkRole(('cm_ka', 'admin_ka'))
-    def storeSelectedCSVParts(self):
-        validator = CasePartSelectionForm()
-        selection_checker = self.__getSelectionChecker()
-        try:
-            params = validator.to_python(request.params)
-            for key, value in params.iteritems():
-                selection_checker.setChecked(key, value)
-            session['selected_export_parts'] = selection_checker
-            session.save()
-        except formencode.Invalid, error:
-            return selectCSVParts()
-        return self.exportCSV(1)
-
     def __getSelectionChecker(self):
+        
         selection_checker = session.get('selected_export_parts')
         if not selection_checker:
             selection_checker = CasePartsSelection()
             session['selected_export_parts'] = selection_checker
             session.save()
+
         return selection_checker
 
     @checkRole(('cm_ka', 'admin_ka'))
@@ -786,16 +774,27 @@
         page = render('casemanagement/selectParts.mako')
         return formencode.htmlfill.render(unicode(page, 'utf-8'),defaults=selection_checker.selections)
 
+    def __store_selection(self, params):
+        selection_checker = self.__getSelectionChecker()
+        new_values = {}
+
+        for k in selection_checker.selections.iterkeys():
+            try:
+                new_values[k] = params[k]
+            except KeyError:
+                new_values[k] = 0
+
+        for key, value in new_values.iteritems():
+            selection_checker.setChecked(key, value)
+
+        session['selected_export_parts'] = selection_checker
+        session.save()
+
     @checkRole(('cm_ka', 'admin_ka'))
     def storeSelectedXMLParts(self):
         validator = CasePartSelectionForm()
-        selection_checker = self.__getSelectionChecker()
         try:
-            params = validator.to_python(request.params)
-            for key, value in params.iteritems():
-                selection_checker.setChecked(key, value)
-            session['selected_export_parts'] = selection_checker
-            session.save()
+            self.__store_selection(validator.to_python(request.params))
         except formencode.Invalid, error:
             return selectXMLParts()
         return self.exportXML(1)
@@ -803,18 +802,22 @@
     @checkRole(('cm_ka', 'admin_ka'))
     def storeSelectedXLSParts(self):
         validator = CasePartSelectionForm()
-        selection_checker = self.__getSelectionChecker()
         try:
-            params = validator.to_python(request.params)
-            for key, value in params.iteritems():
-                selection_checker.setChecked(key, value)
-            session['selected_export_parts'] = selection_checker
-            session.save()
+            self.__store_selection(validator.to_python(request.params))
         except formencode.Invalid, error:
             return selectXLSParts()
         return self.exportXLS(1)
 
     @checkRole(('cm_ka', 'admin_ka'))
+    def storeSelectedCSVParts(self):
+        validator = CasePartSelectionForm()
+        try:
+            self.__store_selection(validator.to_python(request.params))
+        except formencode.Invalid, error:
+            return selectCSVParts()
+        return self.exportCSV(1)
+
+    @checkRole(('cm_ka', 'admin_ka'))
     def downloadXLS(self):
         selection_checker = self.__getSelectionChecker()
         c.is_all_selected = selection_checker.isAllSelected()



More information about the Mpuls-commits mailing list