1
0
mirror of https://github.com/django/django.git synced 2025-04-17 22:04:38 +00:00

magic-removal: Fixed -- 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:
Adrian Holovaty 2006-02-02 04:43:37 +00:00
parent 124944e5ed
commit 77816bc850

@ -605,7 +605,13 @@ def resolve_variable(path, context):
(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]
else:
current = context