From 685e636a93d92421b415bdab727eaa0d24cfe1a7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 17 Apr 2024 18:33:11 -0700 Subject: [PATCH] notification: Handle more formatting errors When there message strings containing substrings of the form "{object.property}", an AttributeError is raised instead of KeyError during string formatting. Catch these errors. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/notification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plinth/notification.py b/plinth/notification.py index 07aee714c..c1be960e0 100644 --- a/plinth/notification.py +++ b/plinth/notification.py @@ -292,7 +292,7 @@ class Notification(models.StoredNotification): string_ = str(string_) if data: string_ = SafeFormatter().vformat(string_, [], data) - except KeyError as error: + except (KeyError, AttributeError) as error: logger.warning( 'Notification missing required key during translation: %s', error)