[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/DB.py You can now creating a database by passing a file-storage file name,
Jim Fulton
jim at zope.com
Sat Oct 25 20:36:42 EDT 2008
Log message for revision 92567:
You can now creating a database by passing a file-storage file name,
rather than a file storage. This makes interactive exploration easier.
This is tested indirectly by the ConflictResolution.txt test. I
expect more tests to take advantage of this convenience. It would be
nice to have an explicit test.
Get WeakSet from the transaction package.
Changed:
U ZODB/trunk/src/ZODB/DB.py
-=-
Modified: ZODB/trunk/src/ZODB/DB.py
===================================================================
--- ZODB/trunk/src/ZODB/DB.py 2008-10-26 00:36:39 UTC (rev 92566)
+++ ZODB/trunk/src/ZODB/DB.py 2008-10-26 00:36:41 UTC (rev 92567)
@@ -28,8 +28,9 @@
from ZODB.utils import z64
from ZODB.Connection import Connection
import ZODB.serialize
-from ZODB.utils import WeakSet
+import transaction.weakset
+
from zope.interface import implements
from ZODB.interfaces import IDatabase
@@ -78,7 +79,7 @@
# A weak set of all connections we've seen. A connection vanishes
# from this set if pop() hands it out, it's not reregistered via
# repush(), and it becomes unreachable.
- self.all = WeakSet()
+ self.all = transaction.weakset.WeakSet()
def setSize(self, size):
"""Change our belief about the expected maximum # of live connections.
@@ -424,6 +425,10 @@
- `historical_timeout`: minimum number of seconds that
an unused historical connection will be kept, or None.
"""
+ if isinstance(storage, basestring):
+ from ZODB import FileStorage
+ storage = ZODB.FileStorage.FileStorage(storage)
+
# Allocate lock.
x = threading.RLock()
self._a = x.acquire
@@ -439,7 +444,7 @@
self._historical_cache_size_bytes = historical_cache_size_bytes
# Setup storage
- self._storage=storage
+ self._storage = storage
self.references = ZODB.serialize.referencesf
try:
storage.registerDB(self)
More information about the Zodb-checkins
mailing list