[Zope-Checkins] CVS: Zope3/lib/python/Persistence - _persistentMapping.py:1.1.2.5

Jeremy Hylton jeremy@zope.com
Wed, 20 Feb 2002 18:57:47 -0500


Update of /cvs-repository/Zope3/lib/python/Persistence
In directory cvs.zope.org:/tmp/cvs-serv22998/Persistence

Modified Files:
      Tag: Zope-3x-branch
	_persistentMapping.py 
Log Message:
Extend PersistentMapping to work with Python and C implementations of
Persistent.

The Persistent C mixin has an __init__, so the PersistentMapping needs
to call both UserDict and Persistent __init__ methods.  For Py
Persistent, it defaults to object.__init__.



=== Zope3/lib/python/Persistence/_persistentMapping.py 1.1.2.4 => 1.1.2.5 ===
 __metaclass__ = type
 
-class PersistentMapping(UserDict, Persistence.Persistent):
+class PersistentMapping(Persistence.Persistent, UserDict):
     """A persistent wrapper for mapping objects.
 
     This class allows wrapping of mapping objects so that object
@@ -36,6 +36,13 @@
     __super_update = UserDict.update
     __super_setdefault = UserDict.setdefault
     __super_popitem = UserDict.popitem
+
+    __super_p_init = Persistence.Persistent.__init__
+    __super_init = UserDict.__init__
+
+    def __init__(self, dict=None):
+        self.__super_init(dict)
+        self.__super_p_init()
 
     def __delitem__(self, key):
         self.__super_delitem(key)