Commit 9a580027 authored by Jim Fulton's avatar Jim Fulton

DemoStorages didn't close their changes databases when they were

created temporarily (not passed to the constructor).
parent 8bf3c3cd
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
Bugs fixed Bugs fixed
---------- ----------
- When a demo storage push method was used to create a new demo
storage and the new storage was closed, the original was
(incorrectly) closed.
- DemoStorages didn't close their changes databases when they were - DemoStorages didn't close their changes databases when they were
created temporarily (not passed to the constructor). created temporarily (not passed to the constructor).
......
...@@ -94,7 +94,12 @@ class DemoStorage(object): ...@@ -94,7 +94,12 @@ class DemoStorage(object):
self.base.cleanup() self.base.cleanup()
self.changes.cleanup() self.changes.cleanup()
__opened = True
def opened(self):
return self.__opened
def close(self): def close(self):
self.__opened = False
if self.close_base_on_close: if self.close_base_on_close:
self.base.close() self.base.close()
if self.close_changes_on_close: if self.close_changes_on_close:
...@@ -253,7 +258,8 @@ class DemoStorage(object): ...@@ -253,7 +258,8 @@ class DemoStorage(object):
return self.base return self.base
def push(self, changes=None): def push(self, changes=None):
return self.__class__(base=self, changes=changes) return self.__class__(base=self, changes=changes,
close_base_on_close=False)
def store(self, oid, serial, data, version, transaction): def store(self, oid, serial, data, version, transaction):
assert version=='', "versions aren't supported" assert version=='', "versions aren't supported"
......
...@@ -185,6 +185,11 @@ The pop method closes the changes storage and returns the base ...@@ -185,6 +185,11 @@ The pop method closes the changes storage and returns the base
>>> changes.opened() >>> changes.opened()
False False
If storage returned by push is closed, the original storage isn't:
>>> demo3.push().close()
>>> demo2.opened()
True
Blob Support Blob Support
============ ============
......
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