On Dec 2, 2009, at 11:41 AM, Muharem Hrnjadovic wrote: > Gary Poster wrote: >> On Dec 2, 2009, at 10:41 AM, Muharem Hrnjadovic wrote: >> >>> Quick question: >>> >>> do we use the zope class registry anywhere? >> >> I doubt it. >> >>> Is it safe to use within >>> Launchpad? >> >> I'd prefer to use utility registration if that can work with your use case. > Sorry for not being precise enough. In my particular case a number of > classes would implement the interface in question (IBuildFarmJob). > > I understood the utility registration mechanism requires that there is > exactly one class that implements a particular interface in which case I > could not use it for the interface/purpose at hand.
The class registry you showed had keys and values. You can register different utilities for the same interface by providing a different name for each one (I think of this as a namespace). You can then get all of the utilities for that interface with getUtilitiesFor. From docs: >>> sorted(components.getUtilitiesFor(tests.I2)) [(u'', U12(2)), (u'three', U12(3))] In that example, ``components`` could be obtained as follows: from zope.component import getSiteManager components = getSiteManager() Is that sufficient? Gary _______________________________________________ Mailing list: https://launchpad.net/~launchpad-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-dev More help : https://help.launchpad.net/ListHelp

