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

2010-01-07 Thread Marius Gedminas
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


signature.asc
Description: Digital signature
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


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

2010-01-07 Thread Jim Fulton
On Thu, Jan 7, 2010 at 7:04 AM, Marius Gedminas mar...@gedmin.as wrote:
 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__())

Yup. Thanks.

Jim

-- 
Jim Fulton
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev