Okay, I was trying to use acquisition from within a __setstate__ method. Doing a little searching I was able to find a message from the Zope list (circa 2001) saying that you can't do it, because the self that __setstate__ acts on isn't acquisiton wrapped. However this is really unfortunate, as I was hoping to acquire some information I need for updated the object from the Zope instance of the top-level site object. Is there a way to do it? Can I explicitly search somehow? Or can I mark the object as needing to be updated and catch it at some other point? (But where!? __bobo_traverse__ perhaps?). Any suggestions? Thanks, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
At 27/11/2003 12:42, you wrote:
Okay, I was trying to use acquisition from within a __setstate__ method. Doing a little searching I was able to find a message from the Zope list (circa 2001) saying that you can't do it, because the self that __setstate__ acts on isn't acquisiton wrapped.
However this is really unfortunate, as I was hoping to acquire some information I need for updated the object from the Zope instance of the top-level site object.
Is there a way to do it? Can I explicitly search somehow?
Or can I mark the object as needing to be updated and catch it at some other point? (But where!? __bobo_traverse__ perhaps?).
Maybe you could wrap some property in a ComputedAttribute and, when called, detect the need for update and do it. Only if you can find ust one (or a few) properties that must fire the update. Gabriel Genellina Softlab SRL
On Thursday 27 November 2003 12:42 pm, Terry Hancock wrote:
Okay, I was trying to use acquisition from within a __setstate__ method. Doing a little searching I was able to find a message from the Zope list (circa 2001) saying that you can't do it, because the self that __setstate__ acts on isn't acquisiton wrapped.
Actually, I did figure out a work-around that fits my problem: I added a step in my manage_addTopic() script like this to make a local reference to the "View" attrib I'm trying to acquire: ob = Topic(...) ob.ViewAlias = self.View self._setObject(id, ob) ob = self._getOb(id) View is a PersistentMapping, so I presume it will act like a normal mutable Python object (so when I make changes to its contents, they'll show up in the alias). I'll have to test this, anyway, to make sure, of course. In the __setstate__ method, Topic computes using the ViewAlias which is a local attribute: for view in self.ViewAlias.keys(): #... do some stuff with this view info pass That seems to solve the problem. Thanks for the replies, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
participants (2)
-
Gabriel Genellina -
Terry Hancock