[ZODB-Dev] Persistent object has empty __dict__ for a little while

Marius Gedminas marius at gedmin.as
Thu Jan 7 07:04:48 EST 2010


On Wed, Jan 06, 2010 at 06:37:31PM -0500, Jim Fulton wrote:
> __dict__ is a special variable. Accessing it doesn't cause an object
> to be activated.
> 
> Rather than doing:
> 
>    clone.__dict__.update(field.__dict__)
> 
> I would do:
> 
>    clone.__setstate__(field.__getstate__)

Nitpick:

     clone.__setstate__(field.__getstate__())

> Alternatively, you can assure that field is acticated first, using
> _p_activate or by accessing an
> attribute.

Regards,
Marius Gedminas
-- 
Those of you thinking that grown men with serious jobs should be above such
phrases as "way friendlier" should realise that in the 21st century, adult
appropriation of infantilisms is de rigueur, innit?
        -- Stuart Jeffries
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20100107/7593c875/attachment.bin 


More information about the ZODB-Dev mailing list