[Zope3-dev] Re: best practices for registry-like functionality
Garrett Smith
garrett at mojave-corp.com
Thu Apr 8 17:57:18 EDT 2004
Jim Fulton wrote:
> Garrett Smith wrote:
>
>> I need to manage a set of vocabulary-like objects for a site. These
>> vocab objects will be used by widgets.
>>
>> These objects are not content, so I want to store and manage them in a
>> site management folder. Specifically, I need to be able to:
>>
>> - Add new vocab objects
>> - Edit existing vocab objects
>> - Delete vocab objects
>> - Lookup a vocabulary by name
>> - Get a list of all registered vocab objects
>>
>> In the past, I would have written a service for this, which would
>> maintain its own contained set of vocab objects. But I suspect I
>> really want a utility,
>
>
> In particular, you want to treat each vocabulary as a utility.
Okay, that makes sense.
As for:
>> - Get a list of all registered vocab objects
Is there a way to enumerate registered utilities that provide a
particular interface?
I suppose I could use a convention and store the utilities in a site
management folder, and use the folder's container API. But this feels a
bit to implicit to me.
Btw, if this is a use case for utilities, 'singleton' would be a
misleading term. The term 'utility' is a bit of a stretch for that
matter. We're talking about 'named objects, registered for a site, that
provide a particular interface'. A good term doesn't come to mind, but
it seems to me worth some more consideration.
-- Garrett
More information about the Zope3-dev
mailing list