web/application.py
changeset 5868 c4380d8cfc25
parent 5736 375819ec7d43
parent 5865 af414723598d
child 6012 d56fd78006cd
child 6109 47d9c0e0f7b7
--- a/web/application.py	Fri Jul 02 11:52:51 2010 +0200
+++ b/web/application.py	Fri Jul 02 14:47:44 2010 +0200
@@ -373,6 +373,7 @@
         # remove user callbacks on a new request (except for json controllers
         # to avoid callbacks being unregistered before they could be called)
         tstart = clock()
+        commited = False
         try:
             try:
                 ctrlid, rset = self.url_resolver.process(req, path)
@@ -390,6 +391,7 @@
                     # displaying some anonymous enabled view such as the cookie
                     # authentication form
                     req.cnx.commit()
+                    commited = True
             except (StatusResponse, DirectResponse):
                 if req.cnx:
                     req.cnx.commit()
@@ -433,7 +435,7 @@
                 self.critical('Catch all triggered!!!')
                 self.exception('this is what happened')
         finally:
-            if req.cnx:
+            if req.cnx and not commited:
                 try:
                     req.cnx.rollback()
                 except: