Directory Service Providers need to be instantiated

Glen Mailer glenjamin at gmail.com
Fri Sep 24 16:20:22 BST 2010


Hi guys,

This is a fairly obscure thing, but here goes:

bzrlib.directory_service.DirectoryServiceRegistry.dereference does the
following:

return service().look_up(name, url)

This means that any directory service has to be a callable which when
called provides an object with a look_up method.

This is rather odd IMO, and also means that every call to dereference
will instantiate an object which gets thrown away.
As the constructor is never passed any arguments, I can't see any
advantages to this approach.

The reason I cane across this and found the behaviour prohibiting is
for the following (draft) plugin: lp:~glenjamin/+junk/bzr-shortcuts

I had to resort to a dodgy __call__ hack since I didn't really want to
create a whole bunch of classes to do exactly the same thing.

Anyway, any thoughts?

Glen
(mostly a Bazaar user, not a Bazaar hacker)



More information about the bazaar mailing list