[z3-five] Does Five support Local Utilities?

Philipp von Weitershausen philipp at weitershausen.de
Tue Sep 19 10:50:29 CEST 2006


Chris Withers wrote:
> Philipp von Weitershausen wrote:
>> Chris Withers wrote:
>>> Does Five support local utilities?
>>
>> Short answer: yup.
> 
> Yay!
> 
>>> If so, what version of Five/Zope do I need?
>>
>> Five 1.2 introduced a local site manager implementation with a much 
>> simpler, but slightly weird API for easy component registration. At 
>> the time, local utilities were really complex to do in Zope 3, so Five 
>> certainly made it easier, but perhaps too easy. What Five does in 
>> versions 1.2 thru 1.4 really is a cheat.
>>
>> Zope 2.10/Five 1.5 allow you to use Zope 3.3's new local component 
>> registries which make things vastly simpler in both Zope 2 and Zope 3. 
>> And it's certainly cleaner in Zope 2, also because Zope 2 doesn't 
>> invent its own machinery but uses the standard one from Zope 3.
> 
> Okay, what ships with Zope 2.9? (Since 2.10 still isn't out)

Dude:

   $ cat $ZOPE_HOME/lib/python/Products/version.txt

RTFM! :)

>> Martin Aspeli and Hanno Schlichting have some good examples for local 
>> utilities done the Zope 3.3 way. Search their blogs or wait for their 
>> replies :)
> 
> Would be interested to see it. In particular, these utilities are along 
> the lines of the catalog indexes example I gave on zope3-users, and so 
> could be local to a single object. Is that supported?

There is no "local to a single object". The zope.component lookup 
functions will query the currently active site manager, which is 
typically set during traversal. If that site manager has the utility 
registered you want to lookup, it'll be found. If not, lookup will 
cascade to site managers higher up the hierarchy. It's acquisition, Zope 
3 style.

Philipp



More information about the z3-five mailing list