[Zope] Re: How do I update objects?
Chris Withers
chrisw@nipltd.com
Thu, 20 Feb 2003 16:58:48 +0000
Thomas Guettler wrote:
> On Mon, Feb 17, 2003 at 03:21:19PM +0200, Cornel Nitu wrote:
>
>>You can try this piece of code ...
>>
>>def __setstate__(self, state):
>> """update"""
>> YourObjectClass.inheritedAttribute('__setstate__')(self, state)
>> if not hasattr(self,'newProperty'):
>> self.newProperty = self.aq_parent.title
>
>
> Hi!
>
> I tried this some time ago. This "magical" update did not work for
> me. If I recall correctly, the function didn't get called if a object
> was in memory.
>
> Now all objects have a refresh method. If I upgrade my source code I
> call this method for all objects.
I wrote this product:
http://www.zope.org/Members/chrisw/UpdateSupport/
...to help write external methods that go through a ZODb an update all objects
of a given type.
It works for me and has worked for numerous Squishdot updates...
cheers,
Chris