[Erp5-report] r24100 - /erp5/trunk/products/CMFActivity/ActivityTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 8 14:08:39 CEST 2008


Author: vincent
Date: Wed Oct  8 14:08:34 2008
New Revision: 24100

URL: http://svn.erp5.org?rev=24100&view=rev
Log:
Stack dump is different if caused by an exception or by a simple dump, so use different formating methods for each one.
Reorder to first log exception before attemping to format it since it might fail: it happens for example when there is an unicode char in exception value and was the reason for commit 22857.

Modified:
    erp5/trunk/products/CMFActivity/ActivityTool.py

Modified: erp5/trunk/products/CMFActivity/ActivityTool.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/ActivityTool.py?rev=24100&r1=24099&r2=24100&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/ActivityTool.py (original)
+++ erp5/trunk/products/CMFActivity/ActivityTool.py Wed Oct  8 14:08:34 2008
@@ -353,17 +353,21 @@
     if is_executed != MESSAGE_EXECUTED:
       if exc_info is None:
         exc_info = sys.exc_info()
-      if extract_stack is not None and exc_info == (None, None, None):
-        exc_info = (None, None, extract_stack())
       if log:
         LOG('ActivityTool', WARNING, 'Could not call method %s on object %s. Activity created at:\n%s' % (self.method_id, self.object_path, self.call_traceback), error=exc_info)
         # push the error in ZODB error_log
         error_log = getattr(context, 'error_log', None)
         if error_log is not None:
           error_log.raising(exc_info)
+      if exc_info == (None, None, None):
+        if format_list is not None:
+          self.traceback = ''.join(format_list(extract_stack()[:-1]))
+        else:
+          self.traceback = ''
+      else:
+        self.traceback = ''.join(ExceptionFormatter.format_exception(*exc_info))
       self.exc_type = exc_info[0]
       self.exc_value = str(exc_info[1])
-      self.traceback = ''.join(ExceptionFormatter.format_exception(*exc_info))
 
   def getExecutionState(self):
     return self.is_executed




More information about the Erp5-report mailing list