-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't use enviroment variable #31
Comments
The intended usage is:
So the behavior I have now is correct. This is the same as doing |
And yeah, I didn't realize this wasn't documented. Should definitely add that. |
(sorry if i bother you.. but just for the records) |
@wifasoi I'd do this: {% if environ('FOO') is none %}
it doesn't exist
{% else %}
{{ environ('FOO') %}
{% elseif %} So instead of |
I noted i can't use the enviroment variable in my template [commit: 4b6c048]. I made some testing with this template:
[export TEST=succes]
{% if environ.TEST is defined %}TEST={{ environ.TEST }}{% endif %}
I pin-poin the issue at this line:
env.globals['environ'] = os.environ.get
I'm not an expert with jinja2, but i think you need to pass a dictionary (I noticed an iterable is fine) and not a fuction.
I fixed by changing the line with:
env.globals['environ'] = dict(os.environ)
or (becouse os.environ is iterable)
env.globals['environ'] = os.environ
I think the functionality need to be documented in the README.
The text was updated successfully, but these errors were encountered: