[Zope-CMF] Re: "_v_skindata" fix
Dieter Maurer
dieter at handshake.de
Thu Feb 24 15:04:40 EST 2005
Florent Guillaume wrote at 2005-2-23 12:54 +0100:
>Dieter Maurer wrote:
> ...
>> Meanwhile, I may have noticed a problem:
>>
>> When my memory is right, then it does not work for nested
>> "Skinnable"s. Because the information is stored
>> in a global structure keyed by thread id only.
> ...
>I agree but I'm not sure I know a way to fix this. From __getattr__
>there is very little that's accessible, and nothing about self's context
>wrappers.
>
>Hm maybe we could store the portal's full path in a persistent
>attribute? And update it after add/clone ?
"Full path" or any other kind of unique identifier.
An alternative would be to return a proxy by "__getattr__"
that defers the lookup until sufficient acquisition
context is available. Would look somehow like:
def __getattr__(self,key):
return _AQDelay(self, key)
...
class _AQDelay(Implicit):
def __init__(self, *args):
self.args = args
def __of__(self, parent):
if not hasattr(parent, 'aq_base'):
# not yet wrapped sufficiently
return self
object, key = self.args
fully_wrapped = object.__of__(parent)
# now perform the lookup
It does not work for method lookup (as they do not get
the correct acquisition context).
I do not advocate for this alternative.
It is too complex and magical...
--
Dieter
More information about the Zope-CMF
mailing list