[Zope-CVS] CVS: Products/Ape/apelib/zope2/setup - patches.py:1.2

Shane Hathaway shane@zope.com
Sat, 29 Mar 2003 14:44:57 -0500

Update of /cvs-repository/Products/Ape/apelib/zope2/setup
In directory cvs.zope.org:/tmp/cvs-serv13976/apelib/zope2/setup

Modified Files:
Log Message:
Stopped using the _p_serial attribute of persistent objects.  ZODB
assumes that _p_serial is a transaction time stamp and uses it to
compute _p_mtime, but that assumption is not valid for Ape.  Until
now, Ape has monkey-patched PersistentExtra to make it so the Zope
application doesn't depend so much on _p_mtime.  But that patch wasn't
enough, since other parts of Zope depend on _p_mtime.

So now Ape stores the object hashes in a dictionary external to the
object and periodically prunes hashes no longer in use.  Once again
Ape got around the need to patch the C code, but only by a narrow
margin.  Hopefully, ZODB 4 already provides a better answer for this

=== Products/Ape/apelib/zope2/setup/patches.py 1.1 => 1.2 ===
--- Products/Ape/apelib/zope2/setup/patches.py:1.1	Sat Mar 15 20:13:46 2003
+++ Products/Ape/apelib/zope2/setup/patches.py	Sat Mar 29 14:44:57 2003
@@ -27,27 +27,6 @@
 from apelib.zodb3.utils import copyOf
-def applyPersistentExtraPatch():
-    # We need to do this until mtimes are made available.
-    # It makes mtime always look like the current time.
-    def bobobase_modification_time(self):
-        jar=self._p_jar
-        oid=self._p_oid
-        if jar is None or oid is None or getattr(jar, 'no_mtime_available', 0):
-            return DateTime()
-        try:
-            t=self._p_mtime
-            if t is None: return DateTime()
-        except: t=0
-        return DateTime(t)
-    from Persistence import Persistent
-    import App.PersistentExtra  # Let Zope do its own patching, then override
-    Persistent.__dict__[
-        'bobobase_modification_time'] = bobobase_modification_time
 def applyCopySupportPatch():
     # Fall back to copying by pickle when ZEXP export/import is not
     # implemented.
@@ -84,7 +63,6 @@
     ZODB.TmpStore.TmpStore = patched_TmpStore
 def applyPatches():
-    applyPersistentExtraPatch()