[Zope-dev] Beyond Acquisition

jalon@dev.in.nuxeo.com jalon@dev.in.nuxeo.com
Fri, 19 Apr 2002 15:28:52 +0000 (UTC)


Here is a simple code:

from Acquisition import Implicit, aq_base

class A(Implicit): pass

class C(Implicit): pass

class B(Implicit):
    def __of__(self, parent):
        # controls the wrapper used for acquisition
        c = C()
        c._parent = parent
        return c.__of__(parent) 
        
a = A() 
a.b = B()

print a.b
# returns <C instance at XXX>

print aq_base(a.b)
# returns the same <C instance at XXX>

It seems there is no way to get the real 'b' attribute from a, i.e. the
B instance set at the line "a.b = B()"

The problem is that I want to do something like this:
aa = A()
cc = aq_realget(a, 'b').__of__(aa)
where aq_realget would return the B instance without to try to put it in
the context of a.

some idea?

thanks in advance.

-- 
Julien Jalon
http://www.nuxeo.com