Commit abe9c429 authored by Jim Fulton's avatar Jim Fulton

Fixed a bug in loadEx that caused it to return incorrect values when

delegating to the base storage.

Added a cleanup method that delegates to the base storage.
parent 9e1edebc
......@@ -219,7 +219,7 @@ class DemoStorage(BaseStorage):
oid, pre, vdata, p, tid = self._index[oid]
except KeyError:
if self._base:
return self._base.load(oid, '')
return self._base.loadEx(oid, version)
raise KeyError(oid)
ver = ""
......@@ -560,3 +560,7 @@ class DemoStorage(BaseStorage):
o.append(' %s: %s' % (oid_repr(oid), r))
return '\n'.join(o)
def cleanup(self):
if self._base is not None:
self._base.cleanup()
......@@ -13,8 +13,12 @@
##############################################################################
import unittest
from ZODB.tests import StorageTestBase, BasicStorage, \
VersionStorage, Synchronization
import transaction
from ZODB.DB import DB
import ZODB.utils
import ZODB.DemoStorage
from ZODB.tests import StorageTestBase, BasicStorage, VersionStorage
from ZODB.tests import Synchronization
class DemoStorageTests(StorageTestBase.StorageTestBase,
BasicStorage.BasicStorage,
......@@ -23,7 +27,6 @@ class DemoStorageTests(StorageTestBase.StorageTestBase,
):
def setUp(self):
import ZODB.DemoStorage
self._storage = ZODB.DemoStorage.DemoStorage()
def tearDown(self):
......@@ -54,6 +57,13 @@ class DemoStorageTests(StorageTestBase.StorageTestBase,
def checkPackVersionsInPast(self):
pass
def checkLoadExDelegation(self):
# Minimal test of loadEX w/o version -- ironically
db = DB(self._storage) # creates object 0. :)
s2 = ZODB.DemoStorage.DemoStorage(base=self._storage)
self.assertEqual(s2.loadEx(ZODB.utils.z64, ''),
self._storage.loadEx(ZODB.utils.z64, ''))
class DemoStorageWrappedBase(DemoStorageTests):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment