Commit d997e27e authored by Jim Fulton's avatar Jim Fulton

Bug fixed:

parent ecbf99ed
...@@ -2,6 +2,19 @@ ...@@ -2,6 +2,19 @@
Change History Change History
================ ================
3.10.0b3 (2010-07-15)
=====================
Bugs fixed
----------
- A change in 3.10.0b2:
"DemoStorages didn't close their changes databases when they were
created temporarily (not passed to the constructor)."
Introduced a backward-compatibility problem for some applications.
3.10.0b2 (2010-07-13) 3.10.0b2 (2010-07-13)
===================== =====================
......
...@@ -39,7 +39,7 @@ class DemoStorage(object): ...@@ -39,7 +39,7 @@ class DemoStorage(object):
) )
def __init__(self, name=None, base=None, changes=None, def __init__(self, name=None, base=None, changes=None,
close_base_on_close=None, close_changes_on_close=True): close_base_on_close=None, close_changes_on_close=None):
if close_base_on_close is None: if close_base_on_close is None:
if base is None: if base is None:
...@@ -56,9 +56,13 @@ class DemoStorage(object): ...@@ -56,9 +56,13 @@ class DemoStorage(object):
self._temporary_changes = True self._temporary_changes = True
changes = ZODB.MappingStorage.MappingStorage() changes = ZODB.MappingStorage.MappingStorage()
zope.interface.alsoProvides(self, ZODB.interfaces.IBlobStorage) zope.interface.alsoProvides(self, ZODB.interfaces.IBlobStorage)
if close_changes_on_close is None:
close_changes_on_close = False
else: else:
if ZODB.interfaces.IBlobStorage.providedBy(changes): if ZODB.interfaces.IBlobStorage.providedBy(changes):
zope.interface.alsoProvides(self, ZODB.interfaces.IBlobStorage) zope.interface.alsoProvides(self, ZODB.interfaces.IBlobStorage)
if close_changes_on_close is None:
close_changes_on_close = True
self.changes = changes self.changes = changes
self.close_changes_on_close = close_changes_on_close self.close_changes_on_close = close_changes_on_close
...@@ -77,12 +81,11 @@ class DemoStorage(object): ...@@ -77,12 +81,11 @@ class DemoStorage(object):
self._next_oid = random.randint(1, 1<<62) self._next_oid = random.randint(1, 1<<62)
__temporary_blobdir = None
def _blobify(self): def _blobify(self):
if (self._temporary_changes and if (self._temporary_changes and
isinstance(self.changes, ZODB.MappingStorage.MappingStorage) isinstance(self.changes, ZODB.MappingStorage.MappingStorage)
): ):
blob_dir = self.__temporary_blobdir = tempfile.mkdtemp('.demoblobs') blob_dir = tempfile.mkdtemp('.demoblobs')
_temporary_blobdirs[ _temporary_blobdirs[
weakref.ref(self, cleanup_temporary_blobdir) weakref.ref(self, cleanup_temporary_blobdir)
] = blob_dir ] = blob_dir
...@@ -104,9 +107,6 @@ class DemoStorage(object): ...@@ -104,9 +107,6 @@ class DemoStorage(object):
self.base.close() self.base.close()
if self.close_changes_on_close: if self.close_changes_on_close:
self.changes.close() self.changes.close()
if (self.__temporary_blobdir and
os.path.exists(self.__temporary_blobdir)):
ZODB.blob.remove_committed_dir(self.__temporary_blobdir)
def _copy_methods_from_changes(self, changes): def _copy_methods_from_changes(self, changes):
for meth in ( for meth in (
......
...@@ -278,9 +278,8 @@ storage wrapped around it when necessary: ...@@ -278,9 +278,8 @@ storage wrapped around it when necessary:
For now, it won't go until the storage does. For now, it won't go until the storage does.
>>> transaction.abort() >>> transaction.abort()
>>> conn.close()
>>> blobdir = storage.temporaryDirectory() >>> blobdir = storage.temporaryDirectory()
>>> del db, conn, storage, _ >>> del storage, _
>>> import gc >>> import gc
>>> _ = gc.collect() >>> _ = gc.collect()
......
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