[Zope3-dev] Re: best practices for registry-like functionality

Jim Fulton jim at zope.com
Fri Apr 9 07:20:25 EDT 2004


Garrett Smith wrote:
> 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?

Yes. See getUtilitiesFor.  This will soon be reimplemented, along with
the utility service.

 > 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.

No need.

 > Btw, if this is a use case for utilities,

Yes

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list