diff options
Diffstat (limited to 'src/jwebmail/__init__.py')
-rw-r--r-- | src/jwebmail/__init__.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/jwebmail/__init__.py b/src/jwebmail/__init__.py index 67018ce..f48db48 100644 --- a/src/jwebmail/__init__.py +++ b/src/jwebmail/__init__.py @@ -4,7 +4,7 @@ from os import environ from shutil import which from babel import parse_locale -from flask import Flask, abort, g, redirect, url_for +from flask import Flask, abort, g, redirect, request_finished, url_for from flask_babel import Babel, get_locale from flask_login import LoginManager, login_required from flask_wtf.csrf import CSRFProtect @@ -36,7 +36,7 @@ else: toml_read_file = dict(load=toml_load, text=True) -__version__ = "2.6.0.dev5" +__version__ = "2.7.0.dev0" csrf = CSRFProtect() @@ -63,7 +63,9 @@ def create_app(): app.config.from_file(environ["JWEBMAIL_CONFIG"], **toml_read_file) if app.config["JWEBMAIL"].get("PROXY"): - app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1) + app.wsgi_app = ProxyFix( + app.wsgi_app, x_for=True, x_proto=True, x_host=True, x_prefix=True + ) validate_config(app) @@ -120,6 +122,12 @@ def create_app(): except ValueError: abort(404) + @request_finished.connect_via(app) + def close_qma(_app, **_): + if "read_mails" in g: + g.read_mails.close() + g.read_mails = None + return app |