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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 27 20:51:14 CEST 2010


Author: bh
Date: 2010-09-27 20:51:13 +0200 (Mon, 27 Sep 2010)
New Revision: 3799

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/formularpage.py
Log:
* mpulsweb/controllers/formularpage.py
(FormularpageController.undo): Turn a bare except into a more
specific one and rework the code a little so that the try-except
only covers the statement where the exception that we want to
catch actually occurs.  It's not completely clear, but the
exception handler was probably only there to catch the case where
the undo action is called for an item that is not in the
uncommited_fields dictionary.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-27 18:45:57 UTC (rev 3798)
+++ base/trunk/ChangeLog	2010-09-27 18:51:13 UTC (rev 3799)
@@ -1,6 +1,17 @@
 2010-09-27  Bernhard Herzog  <bh at intevation.de>
 
 	* mpulsweb/controllers/formularpage.py
+	(FormularpageController.undo): Turn a bare except into a more
+	specific one and rework the code a little so that the try-except
+	only covers the statement where the exception that we want to
+	catch actually occurs.  It's not completely clear, but the
+	exception handler was probably only there to catch the case where
+	the undo action is called for an item that is not in the
+	uncommited_fields dictionary.
+
+2010-09-27  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/controllers/formularpage.py
 	(FormularpageController.edit): Remove unnecessary try-except
 	clause around the self.select call.  In other actions, there's no
 	try-except either.

Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2010-09-27 18:45:57 UTC (rev 3798)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2010-09-27 18:51:13 UTC (rev 3799)
@@ -171,14 +171,15 @@
 
     @checkRole(('cm_ka'))
     def undo(self, id):
-        try:
-            unc = session.get('uncommited_fields')
-            if unc:
+        unc = session.get('uncommited_fields')
+        if unc:
+            try:
                 del unc[id]
+            except KeyError:
+                pass
+            else:
                 session['uncommited_fields'] = unc
                 session.save()
-        except:
-            pass
         return self.select(session['navigation.selectedpage'])
 
     @checkRole(('cm_ka'))



More information about the Mpuls-commits mailing list