mdklatt / cookiecutter-python-app

Cookiecutter template for a Python application project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Explicit `!param` tag resolution fails in config.load()

mdklatt opened this issue · comments

If a YAML scalar is an explicit string, implicit resolution is not performed. In that case, it's necessary to mark the scalar with a tag:

value: !param "${ENV}"

However, this fails:

self = <yaml.loader.SafeLoader object at 0x7fdde5569410>
node = ScalarNode(tag='!param', value='${env1}${env2}')

    def construct_undefined(self, node):
        raise ConstructorError(None, None,
                "could not determine a constructor for the tag %r" % node.tag,
>               node.start_mark)
E       yaml.constructor.ConstructorError: could not determine a constructor for the tag '!param'
E         in "test/data/conf1.yml", line 2, column 6

The ! needs to be explicit when registering the tag name on the loader.

This is no longer relevant with the switch to TOML.