diff --git a/product/CMFActivity/Activity/SQLDict.py b/product/CMFActivity/Activity/SQLDict.py index 19e05ca18a9806c71b925c5e46658fd5e53a7a6e..c9531ac95d3477a2a8b43d207316da2d3ca338e2 100644 --- a/product/CMFActivity/Activity/SQLDict.py +++ b/product/CMFActivity/Activity/SQLDict.py @@ -358,9 +358,8 @@ class SQLDict(RAMDict, SQLBase): # Whatever happens, duplicate uids are to be made available. Only # executed message will get to lower priority or error state. make_available_uid_list.extend(uid_to_duplicate_uid_list_dict.get(uid, [])) - exc_type = m.exc_info[0] - if type(exc_type) is ClassType and \ - issubclass(exc_type, ConflictError): + if type(m.exc_type) is ClassType and \ + issubclass(m.exc_type, ConflictError): delay_uid_list.append(uid) elif priority > MAX_PRIORITY: notify_user_list.append(m) diff --git a/product/CMFActivity/Activity/SQLQueue.py b/product/CMFActivity/Activity/SQLQueue.py index e14ac476ea1ccb3b9fd78f801ec5814db9324553..5475f3aa49154bef344ca8cfa242ad3fadbb4aa1 100644 --- a/product/CMFActivity/Activity/SQLQueue.py +++ b/product/CMFActivity/Activity/SQLQueue.py @@ -198,9 +198,8 @@ class SQLQueue(RAMQueue, SQLBase): if m.active_process: message_with_active_process_list.append(m) else: - exc_type = m.exc_info[0] - if type(exc_type) is ClassType and \ - issubclass(exc_type, ConflictError): + if type(m.exc_type) is ClassType and \ + issubclass(m.exc_type, ConflictError): delay_uid_list.append(uid) elif priority > MAX_PRIORITY: notify_user_list.append(m) diff --git a/product/CMFActivity/ActivityTool.py b/product/CMFActivity/ActivityTool.py index e80cd8c1db8e52dfce95329aa025a63f9f1e6a8f..8d5ae84480aaea782a2c26003d4a502488c8190c 100644 --- a/product/CMFActivity/ActivityTool.py +++ b/product/CMFActivity/ActivityTool.py @@ -115,7 +115,9 @@ class Message: self.args = args self.kw = kw self.is_executed = 0 - self.exc_info = (None, None, None) + self.exc_type = None + self.exc_value = None + self.traceback = None self.processing = None self.user_name = str(_getAuthenticatedUser(self)) # Store REQUEST Info ? @@ -197,13 +199,16 @@ class Message: self.is_executed = 1 except: self.is_executed = 0 - self.exc_info = sys.exc_info() + self.exc_type = sys.exc_info()[0] + self.exc_value = str(sys.exc_info()[1]) + self.traceback = ''.join(ExceptionFormatter.format_exception( + *sys.exc_info())) LOG('ActivityTool', WARNING, 'Could not call method %s on object %s' % ( - self.method_id, self.object_path), error=self.exc_info) + self.method_id, self.object_path), error=sys.exc_info()) # push the error in ZODB error_log if getattr(activity_tool, 'error_log', None) is not None: - activity_tool.error_log.raising(self.exc_info) + activity_tool.error_log.raising(sys.exc_info()) def validate(self, activity, activity_tool, check_order_validation=1): return activity.validate(activity_tool, self, @@ -231,17 +236,16 @@ Subject: %s Document: %s Method: %s +Exception: %s %s %s """ % (activity_tool.email_from_address, user_email, message, message, '/'.join(self.object_path), self.method_id, - ''.join(ExceptionFormatter.format_exception(*self.exc_info))) + self.exc_type, self.exc_value, self.traceback) try: activity_tool.MailHost.send( mail_text ) - except (socket.error, MailHostError): - LOG('ActivityTool.notifyUser', WARNING, 'Mail containing failure information failed to be sent.', error=sys.exc_info()) - if self.exc_info[0] is not None: - LOG('ActivityTool.notifyUser', WARNING, 'Original exception', error=self.exc_info) + except (socket.error, MailHostError), message: + 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)) def reactivate(self, activity_tool): # Reactivate the original object. @@ -840,10 +844,10 @@ class ActivityTool (Folder, UniqueObject): new_message_list.append(m) except: m.is_executed = 0 - m.exc_info = sys.exc_info() + m.exc_type = sys.exc_info()[0] LOG('WARNING ActivityTool', 0, 'Could not call method %s on object %s' % - (m.method_id, m.object_path), error=m.exc_info) + (m.method_id, m.object_path), error=sys.exc_info()) try: if len(expanded_object_list) > 0: @@ -858,10 +862,10 @@ class ActivityTool (Folder, UniqueObject): # In this case, the group method completely failed. for m in new_message_list: m.is_executed = 0 - m.exc_info = sys.exc_info() + m.exc_type = sys.exc_info()[0] LOG('WARNING ActivityTool', 0, 'Could not call method %s on objects %s' % - (method_id, expanded_object_list), error=m.exc_info) + (method_id, expanded_object_list), error=sys.exc_info()) else: # Obtain all indices of failed messages. Note that this can be a partial failure. failed_message_dict = {} @@ -885,10 +889,10 @@ class ActivityTool (Folder, UniqueObject): m.is_executed = 1 except: m.is_executed = 0 - m.exc_info = sys.exc_info() + m.exc_type = sys.exc_info()[0] LOG('ActivityTool', WARNING, 'Could not call method %s on object %s' % ( - m.method_id, m.object_path), error=m.exc_info) + m.method_id, m.object_path), error=sys.exc_info()) def newMessage(self, activity, path, active_process, activity_kw, method_id, *args, **kw):