Skip to content

Commit

Permalink
Remplacement de toml par tomli
Browse files Browse the repository at this point in the history
  • Loading branch information
Situphen committed Nov 7, 2022
1 parent 27c6d58 commit 9084f7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ lxml==4.9.1
Pillow==9.2.0
pymemcache==3.5.2
requests==2.28.1
toml==0.10.2
tomli==2.0.1 ; python_version < "3.11"

# Api dependencies
django-cors-headers==3.13.0
Expand Down
9 changes: 7 additions & 2 deletions zds/settings/abstract_base/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import os
from pathlib import Path
import toml

try:
import tomllib
except ModuleNotFoundError:
import tomli as tomllib


default_config_path = str(Path.cwd() / "config.toml")
config_path = os.environ.get("ZDS_CONFIG", default_config_path)

try:
config = toml.load(config_path)
with open(config_path, "rb") as f:
config = tomllib.load(f)
print(f"Using the config file at {config_path!r}")
except OSError:
config = {}
Expand Down

0 comments on commit 9084f7f

Please sign in to comment.