/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Robert Collins
  • Date: 2005-10-14 04:50:30 UTC
  • mto: This revision was merged to the branch mainline in revision 1456.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051014045030-7d2bf042f48d9133
allow global overriding of signature policy to never check

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        email=John Hacker <jhacker@foo.org>
129
129
        """
130
130
        if self._get_config_parser().has_option('DEFAULT', 'email'):
131
 
            email = self._get_config_parser().get('DEFAULT', 'email')
132
 
            if email is not None:
133
 
                return email
 
131
            return self._get_config_parser().get('DEFAULT', 'email')
134
132
    
 
133
    def _get_signature_checking(self):
 
134
        """See Config._get_signature_checking."""
 
135
        if self._get_config_parser().has_option('DEFAULT', 'signatures'):
 
136
            return self._string_to_signature_policy(
 
137
                self._get_config_parser().get('DEFAULT', 'signatures'))
 
138
 
135
139
    def __init__(self):
136
140
        super(GlobalConfig, self).__init__()
137
141
        self._branches_parser = None
138
142
        self._parser = None
139
143
 
 
144
    def _string_to_signature_policy(self, signature_string):
 
145
        """Convert a string to a signing policy."""
 
146
        if signature_string.lower() == 'ignore':
 
147
            return CHECK_NEVER
 
148
        raise errors.BzrError("Invalid signatures policy '%s'"
 
149
                              % signature_string)
140
150
 
141
151
class LocationConfig(Config):
142
152
    """A configuration object that gives the policy for a location."""