[Zope-dev] Explicit Acquisition within Acquistion.Implicit derived
class
Wyatt Anderson
wyatt95 at hotmail.com
Mon May 24 13:01:28 EDT 2004
Hello,
I am encountering strange behavior when trying to dynamically
set explicit Acquisition within an Acquisition.Implicit object.
The strangeness seems to happen when I refresh the product only,
but I do not feel certain of this which has me a little nervous.
In a Python Product class, named TestAcquisition, I derive
from Folder (which in turn gives me Acquistion.Implicit). This
class defines an attribute which can dynamically be set to
be acquired from nested TestAcquisition objects. In order to
do this I test whether the attribute can be acquired (by checking
to see if aq_parent has the attribute). In the top-level
TestAcquisition object, this attribute should not be acquirable,
and thus it will set it
self.attribute = 1
In sub-objects of TestAcquisition, by default the attribute will
be acquired (which I test and do in manage_afterAdd) by setting
self.aq_explicit.attribute = Attribute.Acquired
I can dynamically unset and set sub-objects acquisition of this
attribute simply by setting
self.attribute = 2
or
self.aq_explicit.attribute = Attribute.Acquired
within the TestAcquistion sub-object. This seems to be working
as desired until I refresh the Product, even just simply adding
a pdb.set_trace() as the only change. After the refresh all
the subobjects that had explicitly been set to acquire the attribute
all return the Special Acquisition Object (Acquisition.Acquired) instead
of the desired value to be acquired.
Is this a bug, something I just have to live with, or am I missing
something on acquisition in my product? I'd really like to keep the
implicit acquisition and not switch to Acquisition.Explicit.
Thanks in advance!
Wyatt
More information about the Zope-Dev
mailing list