From 1986d2c8994c325b5c17b394159c3bfda095659b Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 7 Jan 2008 23:26:13 +0100 Subject: [PATCH] documented pylons' "strict_c". --HG-- branch : trunk --- docs/src/frameworks.txt | 10 ++++++++++ jinja/utils.py | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/src/frameworks.txt b/docs/src/frameworks.txt index 96a1cfa..6511cf7 100644 --- a/docs/src/frameworks.txt +++ b/docs/src/frameworks.txt @@ -87,6 +87,16 @@ It's meant to be used as replacement for the turbogears package name but 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 diff --git a/jinja/utils.py b/jinja/utils.py index 9444c5c..acd2018 100644 --- a/jinja/utils.py +++ b/jinja/utils.py @@ -202,10 +202,7 @@ def get_attribute(obj, name): 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. -- 2.26.2