Skip to content
This repository
Browse code

support for extensions in Jinja2 templates (tx Zhang Huangbin)

  • Loading branch information...
commit eeaa3ff2f8c2fd420a2125da19797dc02cdd5132 1 parent ab3435f
Anand Chitipothu authored March 12, 2009

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  web/contrib/template.py
6  web/contrib/template.py
@@ -82,8 +82,12 @@ class render_jinja:
82 82
         render.hello(name='jinja2')
83 83
     """
84 84
     def __init__(self, *a, **kwargs):
  85
+        extensions = kwargs.pop('extensions', [])
  86
+        globals = kwargs.pop('globals', {})
  87
+
85 88
         from jinja2 import Environment,FileSystemLoader
86  
-        self._lookup = Environment(loader=FileSystemLoader(*a, **kwargs))
  89
+        self._lookup = Environment(loader=FileSystemLoader(*a, **kwargs), extensions=extensions)
  90
+        self._lookup.globals.update(globals)
87 91
         
88 92
     def __getattr__(self, name):
89 93
         # Assuming all templates end with .html

0 notes on commit eeaa3ff

Please sign in to comment.
Something went wrong with that request. Please try again.