[Zope-CVS] CVS: Products/AdaptableStorage/zodb - ASConnection.py:1.9

Shane Hathaway shane@zope.com
Mon, 16 Dec 2002 18:26:42 -0500


Update of /cvs-repository/Products/AdaptableStorage/zodb
In directory cvs.zope.org:/tmp/cvs-serv25263/zodb

Modified Files:
	ASConnection.py 
Log Message:
- loadStub() now expects "hints" that help it avoid loading the entire object
into memory.  mapper_names is a good hint, but frequently unknown to the
application.

- Added modifiedInVersion() to UnmanagedJar, since PersistentExtra expects to
find it.


=== Products/AdaptableStorage/zodb/ASConnection.py 1.8 => 1.9 ===
--- Products/AdaptableStorage/zodb/ASConnection.py:1.8	Fri Dec 13 15:42:03 2002
+++ Products/AdaptableStorage/zodb/ASConnection.py	Mon Dec 16 18:26:42 2002
@@ -100,7 +100,7 @@
         return object
 
 
-    def _persistent_load(self, oid, mapper_names=None):
+    def _persistent_load(self, oid, hints=None):
 
         __traceback_info__=oid
 
@@ -108,19 +108,21 @@
         if obj is not None:
             return obj
 
-        if mapper_names is not None:
-            mapper = self.getRootMapper()
-            for mapper_name in mapper_names:
-                mapper = mapper.getSubMapper(mapper_name)
-            ser = mapper.getSerializer()
+        if hints:
+            mapper_names = hints.get('mapper_names')
+            if mapper_names is not None:
+                mapper = self.getRootMapper()
+                for mapper_name in mapper_names:
+                    mapper = mapper.getSubMapper(mapper_name)
+                ser = mapper.getSerializer()
 
-            object = ser.createEmptyInstance()
-            if object is not None:
-                object._p_oid=oid
-                object._p_jar=self
-                object._p_changed=None
-                self._cache[oid] = object
-                return object
+                object = ser.createEmptyInstance()
+                if object is not None:
+                    object._p_oid=oid
+                    object._p_jar=self
+                    object._p_changed=None
+                    self._cache[oid] = object
+                    return object
 
         # We don't have enough info for fast loading.  Load the whole object.
         return self[oid]
@@ -399,9 +401,9 @@
 
     # IKeyedObjectSystem implementation
 
-    def loadStub(self, keychain, mapper_names=None):
+    def loadStub(self, keychain, hints=None):
         oid = self._db._oid_encoder.encode(keychain)
-        return self._persistent_load(oid, mapper_names)
+        return self._persistent_load(oid, hints)
 
     def identifyObject(self, object):
         oid = object._p_oid
@@ -465,3 +467,6 @@
         o = self.real_jar[self.real_oid]
         o._p_changed = 1
 
+    def modifiedInVersion(self, oid):
+        # XXX PersistentExtra wants this
+        return ''