[Zodb-checkins] CVS: StandaloneZODB/ZODB - BaseStorage.py:1.15

Jeremy Hylton jeremy@zope.com
Wed, 24 Oct 2001 16:46:02 -0400


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv6355/ZODB

Modified Files:
	BaseStorage.py 
Log Message:
Add getSerial() routine that return current revision id for an oid.

BaseStorage implements this in terms of modifiedInVersion() and
load().  Other storages may (perhaps even should) implement it more
efficiently. 


=== StandaloneZODB/ZODB/BaseStorage.py 1.14 => 1.15 ===
     def pack(self, t, referencesf): pass
 
+    def getSerial(self, oid):
+        self._lock_acquire()
+        try:
+            v = self.modifiedInVersion(oid)
+            pickledata, serial = self.load(oid, v)
+            return serial
+        finally:
+            self._lock_release()
+
     def loadSerial(self, oid, serial):
         raise POSException.Unsupported, (
             "Retrieval of historical revisions is not supported")