Ver código fonte

Fix yaml env loading

master
Marien Fressinaud 5 anos atrás
pai
commit
9a223fa105
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3
    3
      boop.py

+ 3
- 3
boop.py Ver arquivo

@@ -24,7 +24,7 @@ OUTPUT_DIR_NAME = "output"
# Configure YAML to accept environment variables in metadata files
# Based on https://stackoverflow.com/a/27232341 solution
pattern = re.compile(r"^ENV\[\'(.*)\'\]$")
yaml.add_implicit_resolver("!pathex", pattern)
yaml.add_implicit_resolver("!pathex", pattern, Loader=yaml.SafeLoader)


def pathex_constructor(loader, node):
@@ -33,7 +33,7 @@ def pathex_constructor(loader, node):
return os.getenv(env_var)


yaml.add_constructor("!pathex", pathex_constructor)
yaml.add_constructor("!pathex", pathex_constructor, yaml.SafeLoader)


def list_galleries_in(path):
@@ -43,7 +43,7 @@ def list_galleries_in(path):
metadata_path = os.path.join(gallery_dir.path, "metadata.yml")
if os.path.exists(metadata_path):
with open(metadata_path, "r") as metadata_file:
metadata = yaml.load(metadata_file)
metadata = yaml.safe_load(metadata_file)

private = False
url = f"{gallery_dir.name}.html"

Carregando…
Cancelar
Salvar