diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 18:50:57 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 18:50:57 +0000 |
| commit | fd233f40d1922c6f3d9dd0e5738397bdc4aac9ef (patch) | |
| tree | 6f1cf07f75bdf200bdb9a33370994e241ed5b38e /django/template/__init__.py | |
| parent | 7352238e16110c139031b01343379596830c48a3 (diff) | |
Fixed #12070. Fixed a case where var._whatever wasn't raising a TemplateSyntaxError.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/template/__init__.py')
| -rw-r--r-- | django/template/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py index 66c415a8c4..203b5e7582 100644 --- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -538,8 +538,6 @@ class FilterExpression(object): var_obj = None elif var is None: raise TemplateSyntaxError("Could not find variable at start of %s." % token) - elif var.find(VARIABLE_ATTRIBUTE_SEPARATOR + '_') > -1 or var[0] == '_': - raise TemplateSyntaxError("Variables and attributes may not begin with underscores: '%s'" % var) else: var_obj = Variable(var) else: @@ -698,6 +696,8 @@ class Variable(object): except ValueError: # Otherwise we'll set self.lookups so that resolve() knows we're # dealing with a bonafide variable + if var.find(VARIABLE_ATTRIBUTE_SEPARATOR + '_') > -1 or var[0] == '_': + raise TemplateSyntaxError("Variables and attributes may not begin with underscores: '%s'" % var) self.lookups = tuple(var.split(VARIABLE_ATTRIBUTE_SEPARATOR)) def resolve(self, context): |
