Changeset 5285

Show
Ignore:
Timestamp:
08/28/08 08:11:09 (4 months ago)
Author:
mramm
Message:

Improved attribute lookup, now handles partial matches, and has safer stripping. Removes all pending TODO's in config.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tg/configuration.py

    r5282 r5285  
    3333    """ 
    3434     
    35     #TODO: Handle keys like "z.y.z" 
    36      
    37     #TODO: Handle partial prefix matching better.  
    38     #      ('s1.' and 's2.' when prefix is s) 
    39      
    40     new_dict = Bunch([(key.split(".")[1] ,dictionary[key])  
     35    match = prefix + "." 
     36     
     37    new_dict = Bunch([(key.lstrip(match) ,dictionary[key])  
    4138                       for key in dictionary.iterkeys()  
    42                        if prefix+'.' in key])  
     39                       if key.startswith(match)])  
    4340    if new_dict: 
    4441        return new_dict