mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixes #1338, Refs #1400, #2237 -- Modified variable resolution to allow template 'if' statements to work if TEMPLATE_STRING_IF_INVALID is set. Modified unit tests to force the use of this variable, so that returning '' isn't confused with an actual failure.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3268 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -37,7 +37,7 @@ class Context(object):
|
||||
for d in self.dicts:
|
||||
if d.has_key(key):
|
||||
return d[key]
|
||||
return settings.TEMPLATE_STRING_IF_INVALID
|
||||
raise KeyError(key)
|
||||
|
||||
def __delitem__(self, key):
|
||||
"Delete a variable from the current context"
|
||||
@@ -49,7 +49,7 @@ class Context(object):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get(self, key, otherwise):
|
||||
def get(self, key, otherwise=None):
|
||||
for d in self.dicts:
|
||||
if d.has_key(key):
|
||||
return d[key]
|
||||
|
||||
Reference in New Issue
Block a user