/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: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#            and others
4
4
#
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.
510
518
        self._write_config_file()
511
519
 
512
520
    def _write_config_file(self):
513
 
        f = open(self._get_filename(), 'wb')
 
521
        path = self._get_filename()
 
522
        f = open(path, 'wb')
 
523
        osutils.copy_ownership_from_path(path)
514
524
        self._get_parser().write(f)
515
525
        f.close()
516
526
 
810
820
            os.mkdir(parent_dir)
811
821
        trace.mutter('creating config directory: %r', path)
812
822
        os.mkdir(path)
 
823
        osutils.copy_ownership_from_path(path)
813
824
 
814
825
 
815
826
def config_dir():
866
877
 
867
878
    This doesn't implicitly create it.
868
879
 
869
 
    On Windows it's in the config directory; elsewhere in the XDG cache directory.
 
880
    On Windows it's in the config directory; elsewhere it's /var/crash
 
881
    which may be monitored by apport.  It can be overridden by
 
882
    $APPORT_CRASH_DIR.
870
883
    """
871
884
    if sys.platform == 'win32':
872
885
        return osutils.pathjoin(config_dir(), 'Crash')
873
886
    else:
874
 
        return osutils.pathjoin(xdg_cache_dir(), 'crash')
 
887
        # XXX: hardcoded in apport_python_hook.py; therefore here too -- mbp
 
888
        # 2010-01-31
 
889
        return os.environ.get('APPORT_CRASH_DIR', '/var/crash')
875
890
 
876
891
 
877
892
def xdg_cache_dir():
1402
1417
 
1403
1418
 
1404
1419
class PlainTextCredentialStore(CredentialStore):
1405
 
    """Plain text credential store for the authentication.conf file."""
 
1420
    __doc__ = """Plain text credential store for the authentication.conf file"""
1406
1421
 
1407
1422
    def decode_password(self, credentials):
1408
1423
        """See CredentialStore.decode_password."""