From f3dee66079ef795a23e4f339044491c76814db12 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Wed, 6 Dec 2023 16:37:34 +0100 Subject: bugfix for toml library usage --- src/jwebmail/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/jwebmail') diff --git a/src/jwebmail/__init__.py b/src/jwebmail/__init__.py index e1afe82..aa4d6a7 100644 --- a/src/jwebmail/__init__.py +++ b/src/jwebmail/__init__.py @@ -27,8 +27,10 @@ from .webmail import ( if sys.version_info >= (3, 11): from tomllib import load as toml_load + toml_read_file = dict(load=toml_load, text=False) else: from toml import load as toml_load + toml_read_file = dict(load=toml_load, text=True) __version__ = "2.0.0" @@ -56,10 +58,9 @@ def create_app(): app.jinja_options = dict(undefined=ChainableUndefined) if app.config["DEBUG"]: - app.config.from_file("../../jwebmail.toml", load=toml_load, text=False) + app.config.from_file("../../jwebmail.toml", **toml_read_file) else: - print(environ["JWEBMAIL_CONFIG"]) - app.config.from_file(environ["JWEBMAIL_CONFIG"], load=toml_load, text=False) + app.config.from_file(environ["JWEBMAIL_CONFIG"], **toml_read_file) if app.config["JWEBMAIL"]["PROXY"]: app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1) -- cgit v1.2.3