[Zodb-checkins] SVN: ZODB/trunk/src/ Bug fixed:

Jim Fulton jim at zope.com
Thu Jul 15 07:21:45 EDT 2010


Log message for revision 114767:
  Bug fixed:
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZODB/DemoStorage.py
  U   ZODB/trunk/src/ZODB/DemoStorage.test

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2010-07-15 11:14:34 UTC (rev 114766)
+++ ZODB/trunk/src/CHANGES.txt	2010-07-15 11:21:45 UTC (rev 114767)
@@ -2,6 +2,19 @@
  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)
 =====================
 

Modified: ZODB/trunk/src/ZODB/DemoStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/DemoStorage.py	2010-07-15 11:14:34 UTC (rev 114766)
+++ ZODB/trunk/src/ZODB/DemoStorage.py	2010-07-15 11:21:45 UTC (rev 114767)
@@ -39,7 +39,7 @@
         )
 
     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 base is None:
@@ -56,9 +56,13 @@
             self._temporary_changes = True
             changes = ZODB.MappingStorage.MappingStorage()
             zope.interface.alsoProvides(self, ZODB.interfaces.IBlobStorage)
+            if close_changes_on_close is None:
+                close_changes_on_close = False
         else:
             if ZODB.interfaces.IBlobStorage.providedBy(changes):
                 zope.interface.alsoProvides(self, ZODB.interfaces.IBlobStorage)
+            if close_changes_on_close is None:
+                close_changes_on_close = True
 
         self.changes = changes
         self.close_changes_on_close = close_changes_on_close
@@ -77,12 +81,11 @@
 
         self._next_oid = random.randint(1, 1<<62)
 
-    __temporary_blobdir = None
     def _blobify(self):
         if (self._temporary_changes and
             isinstance(self.changes, ZODB.MappingStorage.MappingStorage)
             ):
-            blob_dir = self.__temporary_blobdir = tempfile.mkdtemp('.demoblobs')
+            blob_dir = tempfile.mkdtemp('.demoblobs')
             _temporary_blobdirs[
                 weakref.ref(self, cleanup_temporary_blobdir)
                 ] = blob_dir
@@ -104,9 +107,6 @@
             self.base.close()
         if self.close_changes_on_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):
         for meth in (

Modified: ZODB/trunk/src/ZODB/DemoStorage.test
===================================================================
--- ZODB/trunk/src/ZODB/DemoStorage.test	2010-07-15 11:14:34 UTC (rev 114766)
+++ ZODB/trunk/src/ZODB/DemoStorage.test	2010-07-15 11:21:45 UTC (rev 114767)
@@ -278,9 +278,8 @@
    For now, it won't go until the storage does.
 
    >>> transaction.abort()
-   >>> conn.close()
    >>> blobdir = storage.temporaryDirectory()
-   >>> del db, conn, storage, _
+   >>> del storage, _
 
    >>> import gc
    >>> _ = gc.collect()



More information about the Zodb-checkins mailing list