Permalink
Browse files

support for extensions in Jinja2 templates (tx Zhang Huangbin)

  • Loading branch information...
1 parent ab3435f commit eeaa3ff2f8c2fd420a2125da19797dc02cdd5132 @anandology anandology committed Mar 12, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 web/contrib/template.py
@@ -82,8 +82,12 @@ class render_jinja:
render.hello(name='jinja2')
"""
def __init__(self, *a, **kwargs):
+ extensions = kwargs.pop('extensions', [])
+ globals = kwargs.pop('globals', {})
+
from jinja2 import Environment,FileSystemLoader
- self._lookup = Environment(loader=FileSystemLoader(*a, **kwargs))
+ self._lookup = Environment(loader=FileSystemLoader(*a, **kwargs), extensions=extensions)
+ self._lookup.globals.update(globals)
def __getattr__(self, name):
# Assuming all templates end with .html

0 comments on commit eeaa3ff

Please sign in to comment.