mirror of
https://github.com/django/django.git
synced 2025-07-06 02:39:12 +00:00
magic-removal: Fixes #1396 -- Added exception handler (and silent_variable_failure check) for edge case in descriptor lookup.
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2604 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
859e652d36
commit
0d6f2f8707
@ -637,6 +637,11 @@ def resolve_variable(path, context):
|
|||||||
current = current[int(bits[0])]
|
current = current[int(bits[0])]
|
||||||
except (IndexError, ValueError, KeyError):
|
except (IndexError, ValueError, KeyError):
|
||||||
raise VariableDoesNotExist, "Failed lookup for key [%s] in %r" % (bits[0], current) # missing attribute
|
raise VariableDoesNotExist, "Failed lookup for key [%s] in %r" % (bits[0], current) # missing attribute
|
||||||
|
except Exception, e:
|
||||||
|
if getattr(e, 'silent_variable_failure', False):
|
||||||
|
current = settings.TEMPLATE_STRING_IF_INVALID
|
||||||
|
else:
|
||||||
|
raise
|
||||||
del bits[0]
|
del bits[0]
|
||||||
return current
|
return current
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user