[ZODB-Dev] PersistentMapping copy

Gerson Sunye gerson.sunye@net4any.com
Wed, 15 May 2002 18:35:41 +0200


On Wed, 16 Jan 2002 01:07:17 -0500
Jeremy Hylton <jeremy@zope.com> wrote:

> >>>>> "JR" == Joshua Reynolds <joshuar@isogen.com> writes:
> 
>   JR> Is there any compelling reason not to have a copy method on
>   JR> PersistentMapping?  I am trying to update to the latest ZODB and
>   JR> i see that it is gone.  I was thinking something along the lines
>   JR> of
> 
>   JR>      def __copy__(self):
>   JR>          return PersistentMapping(self.data.copy())
> 
> What version of ZODB are you refering to?  The code on the Zope trunk
> now extends UserDict.  UserDict defines a copy() method.

I have exactly the same problem as Joshua.

The following script:

	from PersistentMapping import PersistentMapping
	def test(self):
    		a = PersistentMapping()
    		b = a.copy()

Returns me:

	Error Type: Error
	Error Value: un(shallow)copyable object of type <extension class Persistence.PersistentMapping at ...

I am using Zope v 2.5.1, and PersistentMapping Revision: 1.17.12.1

Any thoughts?