Commit 37b1ac6f authored by Vincent Pelletier's avatar Vincent Pelletier

Products.CMFActivity: Fix username display in failure notifications.

This was broken by:
  commit f363ac65
  Author: Vincent Pelletier <vincent@nexedi.com>
  Date:   Wed Mar 23 15:55:46 2022 +0900

      Products.CMFActivity.ActivityTool: Store user object in activity.
as user_name becomes always None.
parent 58f6b8dc
...@@ -412,6 +412,7 @@ class Message(BaseMessage): ...@@ -412,6 +412,7 @@ class Message(BaseMessage):
else: else:
message = "Activity failed" message = "Activity failed"
path = '/'.join(self.object_path) path = '/'.join(self.object_path)
user = self.user_object
mail_text = """From: %s <%s> mail_text = """From: %s <%s>
To: %s To: %s
Subject: %s: %s/%s Subject: %s: %s/%s
...@@ -424,9 +425,16 @@ Document: %s ...@@ -424,9 +425,16 @@ Document: %s
Method: %s Method: %s
Arguments: %r Arguments: %r
Named Parameters: %r Named Parameters: %r
""" % (email_from_name, activity_tool.email_from_address, user_email, message, """ % (
email_from_name, activity_tool.email_from_address, user_email, message,
path, self.method_id, getCurrentNode(), fail_count, path, self.method_id, getCurrentNode(), fail_count,
self.user_name, self.line.uid, path, self.method_id, self.args, self.kw) (
self.user_name
if user is None else
user.getIdOrUserName()
),
self.line.uid, path, self.method_id, self.args, self.kw,
)
if self.traceback: if self.traceback:
mail_text += '\nException:\n' + self.traceback mail_text += '\nException:\n' + self.traceback
if self.call_traceback: if self.call_traceback:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment