mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
magic-removal: Fixed #1304 -- template.resolve_variable() now resolves integers, as in trunk. When did this get removed, I wonder?
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
124944e5ed
commit
77816bc850
@ -605,7 +605,13 @@ def resolve_variable(path, context):
|
|||||||
|
|
||||||
(The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')
|
(The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')
|
||||||
"""
|
"""
|
||||||
if path[0] in ('"', "'") and path[0] == path[-1]:
|
if path[0] in '0123456789':
|
||||||
|
number_type = '.' in path and float or int
|
||||||
|
try:
|
||||||
|
current = number_type(path)
|
||||||
|
except ValueError:
|
||||||
|
current = ''
|
||||||
|
elif path[0] in ('"', "'") and path[0] == path[-1]:
|
||||||
current = path[1:-1]
|
current = path[1:-1]
|
||||||
else:
|
else:
|
||||||
current = context
|
current = context
|
||||||
|
Loading…
x
Reference in New Issue
Block a user