354
354
# which has a lookup of None
355
355
return _protocol_handlers[None](base)
357
# Local transport should always be initialized
358
import bzrlib.transport.local
361
def register_builtin_transports():
362
"""Register all builtin transport modules.
358
def register_lazy_transport(scheme, module, classname):
359
"""Register lazy-loaded transport class.
361
When opening a URL with the given scheme, load the module and then
362
instantiate the particular class.
365
mod = __import__(module, globals(), locals(), [classname])
366
klass = getattr(mod, classname)
368
register_transport(scheme, _loader)
364
This happens as a sideeffect of importing the modules.
366
import bzrlib.transport.local, \
367
bzrlib.transport.http, \
368
bzrlib.transport.sftp
370
# If nothing else matches, try the LocalTransport
371
register_lazy_transport(None, 'bzrlib.transport.local', 'LocalTransport')
372
register_lazy_transport('file://', 'bzrlib.transport.local', 'LocalTransport')
373
register_lazy_transport('sftp://', 'bzrlib.transport.sftp', 'SFTPTransport')
374
register_lazy_transport('http://', 'bzrlib.transport.http', 'HttpTransport')
375
register_lazy_transport('https://', 'bzrlib.transport.http', 'HttpTransport')