Edgewall Software

Ticket #8290: t8290-config_section-r8198-011.diff

File t8290-config_section-r8198-011.diff, 1009 bytes (added by osimons, 3 years ago)

Patch for lookup and check of Option supplied options.

  • trac/config.py

    diff --git a/trac/config.py b/trac/config.py
    a b  
    145145        while parent: 
    146146            sections |= set(parent.parser.sections()) 
    147147            parent = parent.parent 
     148        sections.update(self.defaults().keys()) 
    148149        return sorted(sections) 
    149150 
    150151    def has_option(self, section, option): 
     
    254255            return True 
    255256        if self.config.parent: 
    256257            return name in self.config.parent[self.name] 
     258        if Option.registry.has_key((self.name, name)): 
     259            return True 
    257260        return False 
    258261 
    259262    def __iter__(self): 
     
    266269            for option in self.config.parent[self.name]: 
    267270                if option.lower() not in options: 
    268271                    yield option 
     272        for section, option in Option.registry.keys(): 
     273            if section == self.name and option.lower() not in options: 
     274                yield option 
    269275 
    270276    def __repr__(self): 
    271277        return '<Section [%s]>' % (self.name)