Oh and,
If you really want direct pass through, completely without undefineds
and attribute/item lookup interchangeability you can do that too:
from jinja2 import Environment
class DirectEnvironment(Environment):
def getitem(self, obj, arg):
return obj[arg]
def getattr(self, obj, arg):
return getattr(obj, arg)
However name lookup will still return undefined objects:
>>> env = DirectEnvironment(undefined=DebugUndefined)
>>> env.from_string('Hello {{ name|upper }}!').render()
u'Hello {{ NAME }}!'
>>> env.from_string('Hello {{ name.meh }}!').render(name=42)
Traceback (most recent call last):
...
AttributeError: 'int' object has no attribute 'meh'
Regards,
Armin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---