From f48cf954f80a4d4b2608da8aaef4feda0f352313 Mon Sep 17 00:00:00 2001 From: Joseph Kocherhans Date: Tue, 23 Feb 2010 18:53:42 +0000 Subject: [1.1.X] Fixed #12070. Fixed a case where var._whatever wasn't raising a TemplateSyntaxError. Backport of r12539 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12540 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/templates/parser.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/templates/parser.py b/tests/regressiontests/templates/parser.py index 6ad301d9c3..6b59896437 100644 --- a/tests/regressiontests/templates/parser.py +++ b/tests/regressiontests/templates/parser.py @@ -27,6 +27,13 @@ u"Some 'Bad' News" [] >>> fe.var u'Some "Good" News' + +Filtered variables should reject access of attributes beginning with underscores. + +>>> FilterExpression('article._hidden|upper', p) +Traceback (most recent call last): +... +TemplateSyntaxError: Variables and attributes may not begin with underscores: 'article._hidden' """ variable_parsing = r""" @@ -56,4 +63,10 @@ u'Some "Good" News' >>> Variable(ur"'Some \'Better\' News'").resolve(c) u"Some 'Better' News" +Variables should reject access of attributes beginning with underscores. + +>>> Variable('article._hidden') +Traceback (most recent call last): +... +TemplateSyntaxError: Variables and attributes may not begin with underscores: 'article._hidden' """ -- cgit v1.3