summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2010-02-23 18:50:57 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2010-02-23 18:50:57 +0000
commitfd233f40d1922c6f3d9dd0e5738397bdc4aac9ef (patch)
tree6f1cf07f75bdf200bdb9a33370994e241ed5b38e /tests/regressiontests
parent7352238e16110c139031b01343379596830c48a3 (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 'tests/regressiontests')
-rw-r--r--tests/regressiontests/templates/parser.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/parser.py b/tests/regressiontests/templates/parser.py
index 9e6ad2166e..4db54556ed 100644
--- a/tests/regressiontests/templates/parser.py
+++ b/tests/regressiontests/templates/parser.py
@@ -76,6 +76,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"""
@@ -105,4 +112,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'
"""