~juju/tarmac/go-bot

« back to all changes in this revision

Viewing changes to tarmac/config.py

  • Committer: Tarmac
  • Author(s): Maris Fogels
  • Date: 2011-01-05 17:22:24 UTC
  • mfrom: (382.1.2 add-branch-config-get)
  • Revision ID: tarmac-20110105172224-s8hqoi8vxbjgtxt6
Add get method to BranchConfig object

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
        if config.has_section(branch_name):
126
126
            for key, val in config.items(branch_name):
127
127
                setattr(self, key, val)
 
128
 
 
129
    def get(self, attr, default=None):
 
130
        '''A convenient method for getting a config key that may be missing.
 
131
 
 
132
        Defaults to None if the key is not set.
 
133
        '''
 
134
        return getattr(self, attr, default)