[PING][merge] Registry

Robert Collins robertc at robertcollins.net
Fri Sep 15 23:10:40 BST 2006


On Thu, 2006-09-14 at 13:52 -0500, John Arbash Meinel wrote:
> John Arbash Meinel wrote:
> > The attached patch finishes up all the work to creating a Registry
> > class, which can lazily import objects and modules.
> > 
> > It also has direct support for help text, and extra information about
> > the registered object.
> 
> Any chance to get this reviewed? It isn't critical for 0.11 any more,
> since I won't have time to write anything based on it for 0.11. But it
> would be nice to get it in sooner rather than later.
> 
> > 
> > The basic idea is that this can become a general class that we use in
> > all of our other registration functionality. So stuff like Transports
> > can be registered using this class, including the ability to late-load them.
> > 
> > I also plan on using it in quite a few other areas. Like the new help
> > topics stuff should use Registry.
> > 

A glitch: theres a typo in NEWS  - thanks for adding the entry though.

I'm -1 on Registry implementing the dict protocol. I think its
untasteful to make objects look like dictionaries if they aren't : and
registry is not really a dictionary : access can fail with ImportError.

specifically I think __getitem__ and __delitem__ are misfeatures for
this class. 

I think theres a better way to structure it where it *is* a dictionary:

Have a class to represent lazy-load-with-help objects, this has methods:
fetch_object()
help_string()
extra_info() 

etc.

Then the big Registry is nothing more than a {} of LazyLoadWithHelp()
objects, and the confusion between 'is this a dict or not' goes away.

So, I'd rather not see this merged as is.

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060916/07a75ac9/attachment.pgp 


More information about the bazaar mailing list