Ticket #3022: resolve_numbers.patch
File resolve_numbers.patch, 715 bytes (added by , 18 years ago) |
---|
-
django/template/__init__.py
604 604 def __str__(self): 605 605 return self.token 606 606 607 re_number = re.compile('[+-]?(\d+|\d*\.\d+)$') 608 607 609 def resolve_variable(path, context): 608 610 """ 609 611 Returns the resolved variable, which may contain attribute syntax, within … … 624 626 625 627 (The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.') 626 628 """ 627 if path[0].isdigit():629 if re_number.match(path[0]): 628 630 number_type = '.' in path and float or int 629 631 try: 630 632 current = number_type(path)