summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2010-03-20 20:31:57 +0000
committerKaren Tracey <kmtracey@gmail.com>2010-03-20 20:31:57 +0000
commitdf010f0a1f4cbbde1f60329201217d49ff5e43c2 (patch)
treef291dee45812abcbb3cacb1c9046879a7174bad3 /tests/regressiontests
parentd5336b221c4aa086d011603375306a37edd4a8ac (diff)
[1.1.X] Fixed #12554: Silence exceptions that have specified silent_variable_failure=True. Thanks Thomas Steinacher, copelco, mlavin.
r12823 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12824 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/templates/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index f240274dd4..6b7b1cef35 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -96,6 +96,10 @@ class OtherClass:
def method(self):
return "OtherClass.method"
+class SilentGetItemClass(object):
+ def __getitem__(self, key):
+ raise SomeException
+
class UTF8Class:
"Class whose __str__ returns non-ASCII data"
def __str__(self):
@@ -344,6 +348,11 @@ class Templates(unittest.TestCase):
'basic-syntax26': (r'{{ "\"fred\"" }}', {}, "\"fred\""),
'basic-syntax27': (r'{{ _("\"fred\"") }}', {}, "\"fred\""),
+ # regression test for ticket #12554
+ # make sure a silent_variable_failure Exception is supressed
+ # on dictionary lookup
+ 'basic-syntax28': ("{{ a.b }}", {'a': SilentGetItemClass()}, ('', 'INVALID')),
+
# List-index syntax allows a template to access a certain item of a subscriptable object.
'list-index01': ("{{ var.1 }}", {"var": ["first item", "second item"]}, "second item"),