From: Armin Ronacher Date: Mon, 24 Dec 2007 14:59:47 +0000 (+0100) Subject: work around a pylons oddity X-Git-Tag: 2.0rc1~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a433c20a597e3af9ad3024f181c3c85879331bd5;p=thirdparty%2Fjinja.git work around a pylons oddity --HG-- branch : trunk --- diff --git a/jinja/utils.py b/jinja/utils.py index 7fe5d2eb..9444c5cb 100644 --- a/jinja/utils.py +++ b/jinja/utils.py @@ -200,8 +200,12 @@ def get_attribute(obj, name): if getattr(obj, '__class__', None) in callable_types and \ name.startswith('func_') or name.startswith('im_'): raise SecurityException('not allowed to access function attributes') + r = _getattr(obj, 'jinja_allowed_attributes', None) - if r is not None and name not in r: + # 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" raise SecurityException('disallowed attribute accessed') # attribute lookups convert unicode strings to ascii bytestrings.