Jinja assumes that the name of the template does not include the package
path.
+.. admonition:: Note
+
+ Special note for pylons users. Jinja will be unable to request attributes
+ from the special `c` object, unless you set `strict_c` to `True` in the
+ `environment.py`:
+
+ .. sourcecode:: python
+
+ return pylons.config.Config(tmpl_options, map, paths, strict_c=True)
+
You can then render the template in the view like this:
.. sourcecode:: python
raise SecurityException('not allowed to access function attributes')
r = _getattr(obj, 'jinja_allowed_attributes', None)
- # the empty string check is for pylons which returns empty strings on
- # it's stacked something foobar object
- if r not in (None, '') and name not in r:
- print "broken here"
+ if r is not None and name not in r:
raise SecurityException('disallowed attribute accessed')
# attribute lookups convert unicode strings to ascii bytestrings.