Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Small improvement to django.template.resolve_variable -- isdigit() in…

…stead of 0123456789

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b78b1b98fff1d7059d7c6b9698857942ac42a4fb 1 parent 3db34ce
Adrian Holovaty authored

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. 6  django/template/__init__.py
6  django/template/__init__.py
@@ -544,7 +544,7 @@ def __init__(self, token, parser):
544 544
                 upto = match.end()
545 545
         if upto != len(token):
546 546
             raise TemplateSyntaxError, "Could not parse the remainder: %s" % token[upto:]
547  
-        self.var , self.filters = var, filters
  547
+        self.var, self.filters = var, filters
548 548
 
549 549
     def resolve(self, context):
550 550
         try:
@@ -614,7 +614,7 @@ def resolve_variable(path, context):
614 614
 
615 615
     (The example assumes VARIABLE_ATTRIBUTE_SEPARATOR is '.')
616 616
     """
617  
-    if path[0] in '0123456789':
  617
+    if path[0].isdigit():
618 618
         number_type = '.' in path and float or int
619 619
         try:
620 620
             current = number_type(path)
@@ -655,7 +655,7 @@ def resolve_variable(path, context):
655 655
                     if getattr(e, 'silent_variable_failure', False):
656 656
                         current = settings.TEMPLATE_STRING_IF_INVALID
657 657
                     else:
658  
-                        raise        
  658
+                        raise
659 659
             del bits[0]
660 660
     return current
661 661
 

0 notes on commit b78b1b9

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