Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

magic-removal: Fixed #1304 -- template.resolve_variable() now resolve…

…s 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
  • Loading branch information...
commit 77816bc850bb108d4b800022066a993f139d7c47 1 parent 124944e
Adrian Holovaty authored February 02, 2006

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  django/template/__init__.py
8  django/template/__init__.py
@@ -605,7 +605,13 @@ def resolve_variable(path, context):
605 605
 
606 606
     (The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')
607 607
     """
608  
-    if path[0] in ('"', "'") and path[0] == path[-1]:
  608
+    if path[0] in '0123456789':
  609
+        number_type = '.' in path and float or int
  610
+        try:
  611
+           current = number_type(path)
  612
+        except ValueError:
  613
+           current = ''
  614
+    elif path[0] in ('"', "'") and path[0] == path[-1]:
609 615
         current = path[1:-1]
610 616
     else:
611 617
         current = context

0 notes on commit 77816bc

Please sign in to comment.
Something went wrong with that request. Please try again.