Changeset 31

Show
Ignore:
Timestamp:
26/08/04 17:16:31 (4 years ago)
Author:
chris
Message:

fix a bug with referencing a non-existent attribute

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/airspeed.py

    r30 r31  
    312312            try: result = current_object[self.name] 
    313313            except KeyError: result = None 
     314            except TypeError: result = None 
    314315        if result is None: 
    315316            return None ## TODO: an explicit 'not found' exception? 
  • trunk/airspeed_test.py

    r30 r31  
    389389        self.assertEquals('Hello Steve. Hello Chris. ', template.merge({})) 
    390390 
     391    def test_when_dictionary_does_not_contain_referenced_attribute_no_substitution_occurs(self): 
     392        template = airspeed.Template(" $user.name ") 
     393        self.assertEquals(" $user.name ", template.merge({'user':self})) 
    391394# 
    392395# TODO: