~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-04-23 08:35:38 UTC
  • mfrom: (5176.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100423083538-2fokv22a7e596kmb
(vila) Warn if a config variable can't be interpreted as a boolean

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
            interpreted as a boolean. Returns True or False otherwise.
194
194
        """
195
195
        s = self._get_user_option(option_name)
196
 
        return ui.bool_from_string(s)
 
196
        if s is None:
 
197
            # The option doesn't exist
 
198
            return None
 
199
        val = ui.bool_from_string(s)
 
200
        if val is None:
 
201
            # The value can't be interpreted as a boolean
 
202
            trace.warning('Value "%s" is not a boolean for "%s"',
 
203
                          s, option_name)
 
204
        return val
197
205
 
198
206
    def get_user_option_as_list(self, option_name):
199
207
        """Get a generic option as a list - no special process, no default.