0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Allow message formatters to take the whole log entry record

This commit is contained in:
Karl Hobley 2021-04-29 12:17:36 +01:00 committed by Karl Hobley
parent 722d8836a9
commit 5e13a74a6d

View File

@ -51,7 +51,11 @@ class LogActionRegistry:
def format_message(self, log_entry):
message = self.get_messages().get(log_entry.action, _('Unknown %(action)s') % {'action': log_entry.action})
if callable(message):
message = message(log_entry.data)
if getattr(message, 'takes_log_entry', False):
message = message(log_entry)
else:
# Pre Wagtail 2.14, we only passed the data into the message generator
message = message(log_entry.data)
return message