Refs #1400 -- Variable resolver now converts literal strings 'False' and 'True' into booleans when used as template arguments. This is point 2 from ticket #1400. Thanks Kieren Holland.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3269 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2006-07-04 03:44:56 +00:00
parent 6b383afd39
commit 4d29cae467
1 changed files with 5 additions and 1 deletions

View File

@ -614,7 +614,11 @@ def resolve_variable(path, context):
(The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.') (The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')
""" """
if path[0].isdigit(): if path == 'False':
path = False
elif path == 'True':
path = True
elif path[0].isdigit():
number_type = '.' in path and float or int number_type = '.' in path and float or int
try: try:
current = number_type(path) current = number_type(path)