Discussion:
[Erp5-dev] [Erp5-report] r19169 - in /erp5/trunk/products/CMFActivity: ./ Activity/
Yoshinori Okuji
2008-02-08 14:42:00 UTC
Permalink
I would like to understand why this change has been made. The original code
avoided explicitly making circular references.

(FYI, read the description of exc_info at
http://docs.python.org/lib/module-sys.html .)

YO
Author: vincent
Date: Fri Feb 8 13:28:30 2008
New Revision: 19169
URL: http://svn.erp5.org?rev=19169&view=rev
Store exception information in native format inside message. Factorises
sys.exc_info calls and exception rendering code.
erp5/trunk/products/CMFActivity/Activity/SQLDict.py
erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
erp5/trunk/products/CMFActivity/ActivityTool.py
Modified: erp5/trunk/products/CMFActivity/Activity/SQLDict.py
http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLDict.py?rev
=19169&r1=19168&r2=19169&view=diff
===========================================================================
=== --- erp5/trunk/products/CMFActivity/Activity/SQLDict.py (original) +++
erp5/trunk/products/CMFActivity/Activity/SQLDict.py Fri Feb 8 13:28:30
message_with_active_process_list.append(m)
- if type(m.exc_type) is ClassType and \
+ exc_type = m.exc_info[0]
+ if type(exc_type) is ClassType and \
delay_uid_list.append(uid)
notify_user_list.append(m)
Modified: erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLQueue.py?re
v=19169&r1=19168&r2=19169&view=diff
===========================================================================
=== --- erp5/trunk/products/CMFActivity/Activity/SQLQueue.py (original) +++
erp5/trunk/products/CMFActivity/Activity/SQLQueue.py Fri Feb 8 13:28:30
message_with_active_process_list.append(m)
- if type(m.exc_type) is ClassType and \
+ exc_type = m.exc_info[0]
+ if type(exc_type) is ClassType and \
delay_uid_list.append(uid)
notify_user_list.append(m)
Modified: erp5/trunk/products/CMFActivity/ActivityTool.py
http://svn.erp5.org/erp5/trunk/products/CMFActivity/ActivityTool.py?rev=191
69&r1=19168&r2=19169&view=diff
===========================================================================
=== --- erp5/trunk/products/CMFActivity/ActivityTool.py (original)
+++ erp5/trunk/products/CMFActivity/ActivityTool.py Fri Feb 8 13:28:30
self.args = args
self.kw = kw
self.is_executed = 0
- self.exc_type = None
- self.exc_value = None
- self.traceback = None
+ self.exc_info = (None, None, None)
self.processing = None
self.user_name = str(_getAuthenticatedUser(self))
# Store REQUEST Info ?
@@ -201,16 +199,13 @@
self.is_executed = 1
self.is_executed = 0
- self.exc_type = sys.exc_info()[0]
- self.exc_value = str(sys.exc_info()[1])
- self.traceback = ''.join(ExceptionFormatter.format_exception(
- *sys.exc_info()))
+ self.exc_info = sys.exc_info()
LOG('ActivityTool', WARNING,
'Could not call method %s on object %s' % (
- self.method_id, self.object_path), error=sys.exc_info())
+ self.method_id, self.object_path), error=self.exc_info)
# push the error in ZODB error_log
- activity_tool.error_log.raising(sys.exc_info())
+ activity_tool.error_log.raising(self.exc_info)
return activity.validate(activity_tool, self,
@@ -238,16 +233,17 @@
Document: %s
Method: %s
-Exception: %s %s
%s
""" % (activity_tool.email_from_address, user_email, message,
message, '/'.join(self.object_path), self.method_id,
- self.exc_type, self.exc_value, self.traceback)
+ ''.join(ExceptionFormatter.format_exception(*self.exc_info)))
activity_tool.MailHost.send( mail_text )
- LOG('ActivityTool.notifyUser', WARNING, 'Mail containing failure
information failed to be sent: %s. Exception was: %s %s\n%s' % (message,
self.exc_type, self.exc_value, self.traceback)) + except (socket.error,
+ LOG('ActivityTool.notifyUser', WARNING, 'Mail containing failure
information failed to be sent.', error=sys.exc_info()) + if
+ LOG('ActivityTool.notifyUser', WARNING, 'Original exception',
error=self.exc_info)
# Reactivate the original object.
@@ -843,10 +839,10 @@
new_message_list.append(m)
m.is_executed = 0
- m.exc_type = sys.exc_info()[0]
+ m.exc_info = sys.exc_info()
LOG('WARNING ActivityTool', 0,
'Could not call method %s on object %s' %
- (m.method_id, m.object_path), error=sys.exc_info())
+ (m.method_id, m.object_path), error=m.exc_info)
@@ -861,10 +857,10 @@
# In this case, the group method completely failed.
m.is_executed = 0
- m.exc_type = sys.exc_info()[0]
+ m.exc_info = sys.exc_info()
LOG('WARNING ActivityTool', 0,
'Could not call method %s on objects %s' %
- (method_id, expanded_object_list), error=sys.exc_info())
+ (method_id, expanded_object_list), error=m.exc_info)
# Obtain all indices of failed messages. Note that this can be a
partial failure. failed_message_dict = {}
@@ -888,10 +884,10 @@
m.is_executed = 1
m.is_executed = 0
- m.exc_type = sys.exc_info()[0]
+ m.exc_info = sys.exc_info()
LOG('ActivityTool', WARNING,
'Could not call method %s on object %s' % (
- m.method_id, m.object_path), error=sys.exc_info())
+ m.method_id, m.object_path), error=m.exc_info)
def newMessage(self, activity, path, active_process,
_______________________________________________
Erp5-report mailing list
Erp5-report at erp5.org
http://mail.nexedi.com/mailman/listinfo/erp5-report
--
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Loading...