Fix crash when sending emails

This commit is contained in:
rubenwardy 2022-01-08 02:42:48 +00:00
parent db4e3dabb7
commit ec6f16c229

@ -121,11 +121,14 @@ def page_not_found(e):
def get_locale():
locales = app.config["LANGUAGES"].keys()
locale = request.cookies.get("locale")
if locale in locales:
return locale
if request:
locale = request.cookies.get("locale")
if locale in locales:
return locale
return request.accept_languages.best_match(locales)
return request.accept_languages.best_match(locales)
return None
@app.route("/set-locale/", methods=["POST"])