[z3-five] context-based utility lookup
Chris Withers
chris at simplistix.co.uk
Mon Feb 12 18:21:38 CET 2007
Philipp von Weitershausen wrote:
>> Do you see that as a good or a bad thing?
>
> The yes was for the "really". If you don't believe me, read the chapter
> on Sites in my book. It's all explained in detail there.
Ah, okay, haven't got to that section in the 2nd Ed yet ;-)
> IMO not having to specify a context is a good thing. Sometimes code
> doesnt' have access to a context, but it still wants to lookup a
> utility. Should it not be possible to let that utility come from a local
> component registry? I as the one who makes up application policy should
> be able to say where that utility comes from.
Indeed, but can you override the context that gets used to figure out
what utility gets picked up?
>> Well, I'd imagine if you went to the trouble of registering local
>> utilities, you did so for a reason?
>
> You're missing the point. The code that's looking up the utility might
> be some completely different piece of software than the piece of code
> that provides the utility.
No, I understand that.
>> If that's the case, then how do I make sure the right utilities are
>> used when I'm traversing around several objects in different locations
>> in the same piece of code?
>
> There's only one kind of traversal -- URL traversal -- and it only
> happens once per request.
Ah, okay. I suspect I'm going to learn lots more about this when I come
to refactoring the publications stuff...
> The other thing sometimes referred to as
> "traversal" is resolving object graphs. That doesnt' trigger the site
> remembering code.
Good ;-)
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the z3-five
mailing list