[ZODB-Dev] Writing Persistent Class

Kenneth Miller xkenneth at gmail.com
Mon Jan 21 13:23:22 EST 2008


Dieter,

     This is fine for me I believe. I only needed to have a copy of an  
object for a short while after the ZODB connection has closed with no  
intention of ever inserting it back into zodb. Out of curiousity, what  
would be the proper way to accomplish this task?

Thanks for your time, everyone.

Regards,
Kenneth Miller

On Jan 21, 2008, at 12:15 PM, Dieter Maurer wrote:

> Marius Gedminas wrote at 2008-1-21 00:08 +0200:
>> Personally, I'd be afraid to use deepcopy on a persistent object.
>
> A deepcopy is likely to be no copy at all.
>
>  As Python's "deepcopy" does not know about object ids, it is likely
>  that the copy result uses the same oids as the original.
>  When you store this copy, objects with the same oid are identified.
>
> If you are lucky, then the ZODB recognizes the problem (because,
> it is unable to store two different objects (the result of the  
> "deepcopy")
> with the same oid in its cache.
>
>
>
> -- 
> Dieter
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zodb-dev



More information about the ZODB-Dev mailing list