This should work fine:

> >>> e = Environment(globals={'isinstance':isinstance})

But remember all the classes that you use with isinstance must be
added to the globals too.

Instead of using isinstance, consider using classes and overriding
__html__, __unicode__, __str__ etc.

Robin

On Jun 25, 8:29 pm, Matt Wilson <[email protected]> wrote:
> On Jun 25, 2:59 pm, Robin B <[email protected]> wrote:
>
> > The language in the templates is not python, it is python-like so that
> > means python built-ins are not expected to be present.  To make python
> > built-ins present in every template, at startup, add any required
> > built-ins to the globals parameter when building the
> > jinja2.Environment.
>
> >http://jinja.pocoo.org/2/documentation/api#high-level-api
>
> Thanks!  I tried this originally:
>
> >>> e = Environment(globals={'isinstance':isinstance})
>
> But that raised an error, so I updated the globals attribute:
>
> >>> e = Environment()
> >>> e.globals = {'isinstance':isinstance}
>
> Can I pass in globals as a a parameter?
>
> Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" 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/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to