mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +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_)
|
string_ = str(string_)
|
||||||
if data:
|
if data:
|
||||||
string_ = SafeFormatter().vformat(string_, [], data)
|
string_ = SafeFormatter().vformat(string_, [], data)
|
||||||
except KeyError as error:
|
except (KeyError, AttributeError) as error:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
'Notification missing required key during translation: %s',
|
'Notification missing required key during translation: %s',
|
||||||
error)
|
error)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user