~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ssh.py

  • Committer: Dmitry Vasiliev
  • Date: 2007-01-13 13:27:23 UTC
  • mto: (2327.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2328.
  • Revision ID: dima@hlabs.spb.ru-20070113132723-7b42wbkb488nf725
Added 'register_default_vendor' method to the SSHVendorManager

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    def __init__(self):
67
67
        self._ssh_vendors = {}
68
68
        self.ssh_vendor = None
 
69
        self._default_ssh_vendor = None
 
70
 
 
71
    def register_default_vendor(self, vendor):
 
72
        """Register default SSH vendor."""
 
73
        self._default_ssh_vendor = vendor
69
74
 
70
75
    def register_vendor(self, name, vendor):
71
 
        """Register new SSH vendor."""
 
76
        """Register new SSH vendor by name."""
72
77
        self._ssh_vendors[name] = vendor
73
78
 
74
79
    def _get_vendor_by_environment(self, environment=None):
123
128
                vendor = self._get_vendor_by_inspection()
124
129
                if vendor is None:
125
130
                    mutter('falling back to default implementation')
126
 
                    vendor = self._ssh_vendors.get('default', None)
 
131
                    vendor = self._default_ssh_vendor
127
132
                    if vendor is None:
128
133
                        raise SSHVendorNotFound()
129
134
            self.ssh_vendor = vendor
131
136
 
132
137
_ssh_vendor_manager = SSHVendorManager()
133
138
_get_ssh_vendor = _ssh_vendor_manager.get_vendor
 
139
register_default_ssh_vendor = _ssh_vendor_manager.register_default_vendor
134
140
register_ssh_vendor = _ssh_vendor_manager.register_vendor
135
141
 
136
142
 
290
296
    vendor = ParamikoVendor()
291
297
    register_ssh_vendor('paramiko', vendor)
292
298
    register_ssh_vendor('none', vendor)
293
 
    register_ssh_vendor('default', vendor)
 
299
    register_default_ssh_vendor(vendor)
294
300
    del vendor
295
301
 
296
302