Django

Code

Changeset 4461

Show
Ignore:
Timestamp:
02/06/07 07:59:24 (2 years ago)
Author:
jacob
Message:

Fixed #3441: VariableDoesNotExist? is now a bit lazier about rendering its error message. Thanks, Brian Harring.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/template/__init__.py

    r4161 r4461  
    118118 
    119119class VariableDoesNotExist(Exception): 
    120     pass 
    121  
     120 
     121    def __init__(self, msg, params=()): 
     122        self.msg = msg 
     123        self.params = params 
     124     
     125    def __str__(self): 
     126        return self.mgs % self.params 
     127     
    122128class InvalidTemplateLibrary(Exception): 
    123129    pass 
     
    661667                        current = current[int(bits[0])] 
    662668                    except (IndexError, ValueError, KeyError): 
    663                         raise VariableDoesNotExist, "Failed lookup for key [%s] in %r" % (bits[0], current) # missing attribute 
     669                        raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bits[0], current)) # missing attribute 
    664670                except Exception, e: 
    665671                    if getattr(e, 'silent_variable_failure', False):