[Erp5-report] r13550 - in /erp5/trunk/products/CMFActivity/Activity: SQLDict.py SQLQueue.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 22 11:51:05 CET 2007


Author: jerome
Date: Thu Mar 22 11:51:04 2007
New Revision: 13550

URL: http://svn.erp5.org?rev=13550&view=rev
Log:
sys.exc_info()[0] can be the error for the try: except inside the big except: clause.
store the exception in a variable to make sure we have the right one.


Modified:
    erp5/trunk/products/CMFActivity/Activity/SQLDict.py
    erp5/trunk/products/CMFActivity/Activity/SQLQueue.py

Modified: erp5/trunk/products/CMFActivity/Activity/SQLDict.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLDict.py?rev=13550&r1=13549&r2=13550&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLDict.py (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLDict.py Thu Mar 22 11:51:04 2007
@@ -305,7 +305,7 @@
             break
         else:
           get_transaction().abort()
-      except:
+      except Exception, exc:
         # If an exception occurs, abort the transaction to minimize the impact,
         try:
           get_transaction().abort()
@@ -313,7 +313,7 @@
           # Unfortunately, database adapters may raise an exception against abort.
           LOG('SQLDict', WARNING, 'abort failed, thus some objects may be modified accidentally')
           pass
-        if issubclass(sys.exc_info()[0], ConflictError):
+        if issubclass(exc, ConflictError):
           # For a conflict error, simply delay the operations.
           for uid_list in uid_list_list:
             if len(uid_list):

Modified: erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLQueue.py?rev=13550&r1=13549&r2=13550&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLQueue.py (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLQueue.py Thu Mar 22 11:51:04 2007
@@ -125,7 +125,7 @@
         activity_tool.invoke(m) # Try to invoke the message
         if m.is_executed:                                          # Make sure message could be invoked
           get_transaction().commit()                                        # If successful, commit
-      except:
+      except Exception, exc:
         # If an exception occurs, abort the transaction to minimize the impact,
         try:
           get_transaction().abort()
@@ -134,7 +134,7 @@
           LOG('SQLQueue', WARNING, 'abort failed, thus some objects may be modified accidentally')
           pass
 
-        if issubclass(sys.exc_info()[0], ConflictError):
+        if issubclass(exc, ConflictError):
           # If a conflict occurs, delay the operation.
           activity_tool.SQLQueue_setPriority(uid = line.uid, date = next_processing_date,
                                              priority = line.priority)




More information about the Erp5-report mailing list