[Mpuls-commits] r4007 - in base/trunk: . mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 21 14:51:56 CEST 2010


Author: bh
Date: 2010-10-21 14:51:54 +0200 (Thu, 21 Oct 2010)
New Revision: 4007

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/logbook.py
Log:
* mpulsweb/model/logbook.py (Logbook.loadById): Remove an
unnecessary exception handler.  When the now-removed handler is
executed, the cur.execute call will either not have been done at
all or will have failed.  In both cases trying to fetch results
from the cursor after the exception handler finished, will lead to
an exception because there are no results to fetch at all.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-10-21 11:51:22 UTC (rev 4006)
+++ base/trunk/ChangeLog	2010-10-21 12:51:54 UTC (rev 4007)
@@ -1,5 +1,14 @@
 2010-10-21  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/logbook.py (Logbook.loadById): Remove an
+	unnecessary exception handler.  When the now-removed handler is
+	executed, the cur.execute call will either not have been done at
+	all or will have failed.  In both cases trying to fetch results
+	from the cursor after the exception handler finished, will lead to
+	an exception because there are no results to fetch at all.
+
+2010-10-21  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/case_bundle.py
 	(CaseBundleController.exportAction): CSV export is now done with
 	zip files so change extension and mime-type accordingly.

Modified: base/trunk/mpulsweb/model/logbook.py
===================================================================
--- base/trunk/mpulsweb/model/logbook.py	2010-10-21 11:51:22 UTC (rev 4006)
+++ base/trunk/mpulsweb/model/logbook.py	2010-10-21 12:51:54 UTC (rev 4007)
@@ -237,20 +237,16 @@
         try:
             conn = db.getConnection()
             cur = conn.cursor()
-            try:
-                # Removed prepared statement as quoting does not work
-                # for sorting e.g
-                # cur.execute(LOAD_LOGBOOK, {'mid': mid, 'field': sort_field,
-                #                            'order': sort_order})
-                if (sort_field not in ALLOWED_SORTING
-                    or sort_order not in ALLOWED_SORTING):
-                    sort_field = 'datum'
-                    sort_order = 'desc'
-                cur.execute(LOAD_LOGBOOK % (mid, sort_field, sort_order))
-            except Exception, e:
-                log.debug("excepion while trying to do this: %s" % cur.query)
-                log.debug("this is what went wront: %s" % e)
-            
+            # Removed prepared statement as quoting does not work
+            # for sorting e.g
+            # cur.execute(LOAD_LOGBOOK, {'mid': mid, 'field': sort_field,
+            #                            'order': sort_order})
+            if (sort_field not in ALLOWED_SORTING
+                or sort_order not in ALLOWED_SORTING):
+                sort_field = 'datum'
+                sort_order = 'desc'
+            cur.execute(LOAD_LOGBOOK % (mid, sort_field, sort_order))
+
             while True:
                 row = cur.fetchone()
                 if not row:



More information about the Mpuls-commits mailing list