I was having this exact problem more than eight years later
(https://imgs.xkcd.com/comics/wisdom_of_the_ancients.png), and I realized
after much hair-pulling that I had been overriding the jinja enivronment
globals dict. So be careful not to do that. You can add stuff to the
globals dict; just don't overwrite it with an empty dictionary and then
populate it with your keys and values.
env = Environment(loader = FileSystemLoader('templates/'))
env.globals = {'my_key': 'my_val'} # Don't do this!
env.globals['my_key'] = 'my_val'] # Do this instead.
On Monday, January 18, 2010 at 1:47:04 AM UTC-8, Voltron wrote:
>
> This version of Jinja2 is in my path:
> ./jinja2-2.2.1-py2.6.egg
>
> Strange thing is, some of the built ins do not work:
>
> {% for page in range(num_pages) %}
> UndefinedError: 'range' is undefined
> ...
>
> The lipsum() function also returns undefined. Are these functions
> deprecated? Have I done something wrong?
>
>
> Thanks
>
>
>
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pocoo-libs.
For more options, visit https://groups.google.com/d/optout.