[Zope3-Users] Re: looking for something like getUtilitiesFor...
chris at simplistix.co.uk
Tue Sep 19 03:02:56 EDT 2006
Philipp von Weitershausen wrote:
> Utilities are never created when they're looked up. They're created when
> registered. Singletons (instances) are registered with the utility
> registry, never factories.
Ah, yes, of course, I think I'm looking for local utilities...
>> and all I'm then doing with the list is generating a drop-down for
>> people to select from...
> getUtilitiesFor is all we have. If you want that drop-down, consider
> using UtilityVocabulary from zope.app.component.vocabulary, e.g.:
> class FooUtilityNames(UtilityVocabulary):
> interface = IFoo
> nameOnly = True
> Register that as a utility:
> <utility component="...FooUtilityNames" name="Foo Utilities"/>
> Then you can refer to it from a schema definition (Choice field).
Hmm, okay, how have the UI's for the creation of local utilities been
built? (I'm thinking there must be some kind of drop-down somewhere with
an "Add list" as in Zope 2's ZMI, and that must include the available
types of local utility?)
Also, more theoretically, would you see indexes for a catalog as being
local utilities. If not, what would you see them as being?
Simplistix - Content Management, Zope & Python Consulting
More information about the Zope3-users