[Zodb-checkins] SVN: ZODB/branches/tseaver-python_picklecache-2/src/persistent/ Don't raise KeyError for OID collision w/ same value object.
Tres Seaver
tseaver at palladion.com
Tue Sep 27 12:31:05 EST 2011
Log message for revision 122972:
Don't raise KeyError for OID collision w/ same value object.
Also, implement stub of 'update_object_size_estimation'.
Changed:
U ZODB/branches/tseaver-python_picklecache-2/src/persistent/picklecache.py
U ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pypicklecache.py
-=-
Modified: ZODB/branches/tseaver-python_picklecache-2/src/persistent/picklecache.py
===================================================================
--- ZODB/branches/tseaver-python_picklecache-2/src/persistent/picklecache.py 2011-09-27 17:31:03 UTC (rev 122971)
+++ ZODB/branches/tseaver-python_picklecache-2/src/persistent/picklecache.py 2011-09-27 17:31:04 UTC (rev 122972)
@@ -65,7 +65,8 @@
raise ValueError('OID must be string: %s' % oid)
# XXX
if oid in self.persistent_classes or oid in self.data:
- raise KeyError('Duplicate OID: %s' % oid)
+ if self.data[oid] is not value:
+ raise KeyError('Duplicate OID: %s' % oid)
if type(value) is type:
self.persistent_classes[oid] = value
else:
@@ -255,3 +256,5 @@
elif oid in self.persistent_classes:
del self.persistent_classes[oid]
+ def update_object_size_estimation(self, oid, new_size):
+ pass
Modified: ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pypicklecache.py
===================================================================
--- ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pypicklecache.py 2011-09-27 17:31:03 UTC (rev 122971)
+++ ZODB/branches/tseaver-python_picklecache-2/src/persistent/tests/test_pypicklecache.py 2011-09-27 17:31:04 UTC (rev 122972)
@@ -92,6 +92,7 @@
cache = self._makeOne()
original = self._makePersist()
cache['original'] = original
+ cache['original'] = original # doesn't raise
duplicate = self._makePersist()
try:
More information about the Zodb-checkins
mailing list