On Fri, Aug 20, 2010 at 5:01 AM, Peter Hartmann <[email protected]> wrote:
> Sorry for bothering you again. I really didn't knew where to ask about
> it, cause Pylons apparently supports Jinja2 templates but this may be
> an issue with Jinja2's documentation as well...
>
> So i'm doing as mentioned here:
> http://jinja.pocoo.org/2/documentation/integration#pylons
>
> And what's next... Apparently, pylons.templating.render_template looks
> for jinja_env in globs['app_globals'] and throws:
>
> AttributeError: 'Globals' object has no attribute 'jinja2_env'
>
> Not sure where the globs dictionary came from. I looked at traceback
> and it shows 'pylons.app_globals' key, but gives KeyError when asked
> for it. On the other hand, modifying docs code and trying:
>
> config['app_globals'].jinja_env = ...
>
> in project's environment.py gives KeyError as well. Just how are those
> globals tossed around?

The line in environment.py should be:

config['pylons.app_globals'].jinja_env = ...

I'm not sure about the Globals error or the traceback since I can't
see the traceback or explore the runtime environment. Possibly a line
is out of order somewhere, using app_globals before it's initialized.

In the render_template() subfunction of render_jinja2(), 'globs' is a
local dict containing the result of pylons_globals(). That function
returns the implicit variables for the template namespace:
tmpl_context, c, app_globals, h, etc. So
``config["pylons.app_globals"] is globs["app_globals"]``.

I would create a new application answering "jinja2" to the template
question, and look for differences between it and your app.

Also, if you're using Pylons 1.0, the ``config['pylons.strict_c']`` on
the Jinja2 page is now ``config['pylons.strict_tmpl_context']``.

-- 
Mike Orr <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to