~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Vincent Ladeuil
  • Date: 2011-06-16 05:21:36 UTC
  • mfrom: (5743.8.25 config-hooks)
  • mto: This revision was merged to the branch mainline in revision 5976.
  • Revision ID: v.ladeuil+lp@free.fr-20110616052136-g4d3yjrqo8knv3x2
Implement config hooks

Show diffs side-by-side

added added

removed removed

Lines of Context:
3101
3101
        """
3102
3102
        try:
3103
3103
            configobj = self._get_configobj()
 
3104
            section_obj = None
3104
3105
            if section is None:
3105
3106
                section_obj = configobj
3106
3107
            else:
3107
3108
                try:
3108
3109
                    section_obj = configobj[section]
3109
3110
                except KeyError:
3110
 
                    return default
3111
 
            return section_obj.get(name, default)
 
3111
                    pass
 
3112
            if section_obj is None:
 
3113
                value = default
 
3114
            else:
 
3115
                value = section_obj.get(name, default)
3112
3116
        except errors.UnknownSmartMethod:
3113
 
            return self._vfs_get_option(name, section, default)
 
3117
            value = self._vfs_get_option(name, section, default)
 
3118
        for hook in config.OldConfigHooks['get']:
 
3119
            hook(self, name, value)
 
3120
        return value
3114
3121
 
3115
3122
    def _response_to_configobj(self, response):
3116
3123
        if len(response[0]) and response[0][0] != 'ok':
3117
3124
            raise errors.UnexpectedSmartServerResponse(response)
3118
3125
        lines = response[1].read_body_bytes().splitlines()
3119
 
        return config.ConfigObj(lines, encoding='utf-8')
 
3126
        conf = config.ConfigObj(lines, encoding='utf-8')
 
3127
        for hook in config.OldConfigHooks['load']:
 
3128
            hook(self)
 
3129
        return conf
3120
3130
 
3121
3131
 
3122
3132
class RemoteBranchConfig(RemoteConfig):