1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

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
This commit is contained in:
Joseph Kocherhans
2010-02-23 18:50:57 +00:00
parent 7352238e16
commit fd233f40d1
2 changed files with 15 additions and 2 deletions

View File

@@ -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):