[z3-five] Does Five support Local Utilities?
Chris Withers
chris at simplistix.co.uk
Tue Sep 19 11:07:19 CEST 2006
Philipp von Weitershausen wrote:
> 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.
Oh, this sucks :-(
I can't get the semantics I'm after unless I do nasty things:
(pseudo-ish code)
from copy import deepcopy
from twiddler.interfaces import IInput
from twiddler.zope2.interfaces import IConfigurableComponent
from zope.component import getUtility
def setInput(self,name):
input = getUtility(IInput,name)
if IConfigurableComponent.providedBy(input):
input = deepcopy(input)
self.input = input
...in order to be able to configure the input for that particular
Twiddler instance, without that configuration affection the use of the
input in all instances that use it.
I don't know how evil the above it, would be interested on people's views...
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the z3-five
mailing list