mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
5c101a1447
commit
685e636a93
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user