summaryrefslogtreecommitdiff
path: root/src/jwebmail/__init__.py
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-12-06 16:37:34 +0100
committerJannis M. Hoffmann <jannis@fehcom.de>2023-12-06 16:37:34 +0100
commitf3dee66079ef795a23e4f339044491c76814db12 (patch)
treef61494db9e17ca7a2ffe3fe9ac154e59a1399972 /src/jwebmail/__init__.py
parentb747e65de17eb65f0390731371becbe3a958a3ce (diff)
bugfix for toml library usage
Diffstat (limited to 'src/jwebmail/__init__.py')
-rw-r--r--src/jwebmail/__init__.py7
1 files changed, 4 insertions, 3 deletions
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)