From 390bf7a657b76b4ece3e1c9a938a1aa668269489 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 23 Jan 2022 17:14:03 +0000 Subject: [PATCH] Fix two crashes due to translations --- app/tasks/emails.py | 2 +- app/utils/flask.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/tasks/emails.py b/app/tasks/emails.py index 602a089..db2cc22 100644 --- a/app/tasks/emails.py +++ b/app/tasks/emails.py @@ -140,7 +140,7 @@ def send_notification_digest(notifications: [Notification], locale): return with force_locale(locale or "en"): - msg = Message(gettext("%(num)d new notifications", len(notifications)), recipients=[user.email]) + msg = Message(gettext("%(num)d new notifications", num=len(notifications)), recipients=[user.email]) msg.body = "".join(["<{}> {}\n{}: {}\n\n".format(notification.causer.display_name, notification.title, gettext("View"), abs_url(notification.url)) for notification in notifications]) diff --git a/app/utils/flask.py b/app/utils/flask.py index 3947591..b8a467d 100644 --- a/app/utils/flask.py +++ b/app/utils/flask.py @@ -45,6 +45,9 @@ def abs_url_samesite(path): return urlunparse(base._replace(path=path)) def url_current(abs=False): + if request.args is None or request.view_args is None: + return None + args = MultiDict(request.args) dargs = dict(args.lists()) dargs.update(request.view_args)