[Zope-CVS] CVS: Products/DBTab - DBTab.py:1.3 StorageTypes.py:1.4 version.txt:1.4

Shane Hathaway shane@zope.com
Mon, 9 Dec 2002 17:24:17 -0500


Update of /cvs-repository/Products/DBTab
In directory cvs.zope.org:/tmp/cvs-serv836

Modified Files:
	DBTab.py StorageTypes.py version.txt 
Log Message:
Added AdaptableStorage and BerkeleyStorage to the list of easily-configured
storage types.


=== Products/DBTab/DBTab.py 1.2 => 1.3 ===
--- Products/DBTab/DBTab.py:1.2	Wed Oct 16 17:13:04 2002
+++ Products/DBTab/DBTab.py	Mon Dec  9 17:24:16 2002
@@ -31,6 +31,7 @@
 
 database_types = {
     'DB': 'ZODB.DB',
+    'Zope2FSDatabase': 'Products.AdaptableStorage.Zope2FS',
     }
 
 connection_types = {
@@ -145,20 +146,23 @@
         m = __import__(module, globals(), locals(), [c])
         self.database_class = getattr(m, c)
 
-        c = params.get('connection_class', 'Connection')
-        pos = c.rfind('.')
-        module = None
-        if pos >= 0:
-            module = c[:pos]
-            c = c[pos + 1:]
-        if not module:
-            # Use a default module.
-            module = connection_types.get(c)
+        c = params.get('connection_class', '')
+        if c:
+            pos = c.rfind('.')
+            module = None
+            if pos >= 0:
+                module = c[:pos]
+                c = c[pos + 1:]
             if not module:
-                raise DBTabConfigurationError(
-                    'Unknown connection class: %s' % c)
-        m = __import__(module, globals(), locals(), [c])
-        self.connection_class = getattr(m, c)
+                # Use a default module.
+                module = connection_types.get(c)
+                if not module:
+                    raise DBTabConfigurationError(
+                        'Unknown connection class: %s' % c)
+            m = __import__(module, globals(), locals(), [c])
+            self.connection_class = getattr(m, c)
+        else:
+            self.connection_class = None
 
         # Pull out the options for the factory rather than the database.
         args = params.copy()
@@ -207,7 +211,8 @@
                 'Unknown class factory: %s' % cf_name)
         storage = self.storage_class(**self.storage_args)
         database = self.database_class(storage, **self.database_args)
-        database.klass = self.connection_class
+        if self.connection_class is not None:
+            database.klass = self.connection_class
         database.setClassFactory(cf)
         # Each database has an independent record of activity.
         database.setActivityMonitor(ActivityMonitor())


=== Products/DBTab/StorageTypes.py 1.3 => 1.4 ===
--- Products/DBTab/StorageTypes.py:1.3	Tue Oct 29 13:20:04 2002
+++ Products/DBTab/StorageTypes.py	Mon Dec  9 17:24:16 2002
@@ -2,14 +2,14 @@
 #
 # Copyright (c) 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
-# 
+# FOR A PARTICULAR PURPOSE.
+#
 ##############################################################################
 """DBTab default storage types.
 
@@ -105,12 +105,31 @@
     return kw
 
 
+def convertBDBStorageArgs(**kw):
+    from bsddb3Storage.BerkeleyBase import BerkeleyConfig
+    config = BerkeleyConfig()
+    for name in dir(BerkeleyConfig):
+        if name.startswith('_'):
+            continue
+        val = kw.get(name)
+        if val is not None:
+            if name != 'logdir':
+                val = int(val)
+            setattr(config, name, val)
+            del kw[name]
+    # XXX: Nobody ever passes in env
+    assert not kw.has_key('env')
+    kw['config'] = config
+    return kw
+
+
 storage_types = {
     'FileStorage': ('ZODB.FileStorage', convertFileStorageArgs),
     'DemoStorage': ('ZODB.DemoStorage', None),
     'MappingStorage': ('ZODB.MappingStorage', None),
     'TemporaryStorage': ('Products.TemporaryFolder.TemporaryStorage', None),
     'ClientStorage': ('ZEO.ClientStorage', convertClientStorageArgs),
+    'Full': ('bsddb3Storage.Full', convertBDBStorageArgs),
+    'Minimal': ('bsddb3Storage.Minimal', convertBDBStorageArgs),
+    'Zope2FSStorage': ('Products.AdaptableStorage.Zope2FS', None),
     }
-
-


=== Products/DBTab/version.txt 1.3 => 1.4 ===
--- Products/DBTab/version.txt:1.3	Tue Nov 19 15:03:19 2002
+++ Products/DBTab/version.txt	Mon Dec  9 17:24:16 2002
@@ -1 +1 @@
-DBTab-1.0
+DBTab-1.0+