[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - datatypes.py:1.10 zopeschema.xml:1.13
Chris McDonough
chrism@zope.com
Sun, 20 Jul 2003 12:22:06 -0400
Update of /cvs-repository/Zope/lib/python/Zope/Startup
In directory cvs.zope.org:/tmp/cvs-serv8679/lib/python/Zope/Startup
Modified Files:
datatypes.py zopeschema.xml
Log Message:
Make /temp_folder a default database.
Import TemporaryFolder into zope schema so it can be specified in a config file.
=== Zope/lib/python/Zope/Startup/datatypes.py 1.9 => 1.10 ===
--- Zope/lib/python/Zope/Startup/datatypes.py:1.9 Sat Jul 19 23:04:12 2003
+++ Zope/lib/python/Zope/Startup/datatypes.py Sun Jul 20 12:22:00 2003
@@ -16,7 +16,6 @@
import os
from ZODB.config import ZODBDatabase
-from ZODB.config import FileStorage
# generic datatypes
@@ -123,7 +122,7 @@
section.lock_filename = os.path.join(section.clienthome, 'Z2.lock')
if not section.databases:
- section.databases = [getDefaultDatabaseFactory(section)]
+ section.databases = getDefaultDatabaseFactories(section)
mount_factories = {} # { name -> factory}
mount_points = {} # { virtual path -> name }
@@ -196,31 +195,47 @@
return (real_root, real_path, self.container_class)
raise LookupError('Nothing known about mount path %s' % mount_path)
-def getDefaultDatabaseFactory(context):
+def getDefaultDatabaseFactories(context):
# default to a filestorage named 'Data.fs' in clienthome
+ # and a temporary storage for session data
+ from ZODB.Connection import Connection
+ from ZODB.config import FileStorage
+ from Products.TemporaryFolder.config import TemporaryStorage
+
+ l = []
class dummy:
- def __init__(self, name):
+ def __init__(self, name, **kw):
self.name = name
+ for k, v in kw.items():
+ setattr(self, k, v)
+
def getSectionName(self):
return self.name
- from ZODB.Connection import Connection
-
path = os.path.join(context.clienthome, 'Data.fs')
- fs_ns = dummy('default filestorage at %s' % path)
- fs_ns.path = path
- fs_ns.create = None
- fs_ns.read_only = None
- fs_ns.quota = None
- storage = FileStorage(fs_ns)
- db_ns = dummy('main')
- db_ns.storage = storage
- db_ns.cache_size = 5000
- db_ns.pool_size = 7
- db_ns.version_pool_size=3
- db_ns.version_cache_size = 100
- db_ns.mount_points = ['/']
- db_ns.connection_class = Connection
- db_ns.class_factory = None
- return ZopeDatabase(db_ns)
+
+ fs = dummy('default filestorage at %s' % path, path=path,
+ create=None, read_only=None, quota=None)
+ main = ZopeDatabase(dummy('main', storage=FileStorage(fs), cache_size=5000,
+ pool_size=7, version_pool_size=3,
+ version_cache_size=100, mount_points=['/'],
+ connection_class=Connection,
+ class_factory=None))
+
+ l.append(main)
+
+ ts = dummy('temporary storage for sessioning')
+ temporary = ZopeDatabase(dummy('temporary', storage=TemporaryStorage(ts),
+ cache_size=5000, pool_size=7,
+ version_pool_size=3, version_cache_size=100,
+ mount_points=['/temp_folder'],
+ connection_class=Connection,
+ class_factory=None))
+
+ temporary.container_class = ('Products.TemporaryFolder.TemporaryFolder.'
+ 'SimpleTemporaryContainer')
+ l.append(temporary)
+
+ return l
+
=== Zope/lib/python/Zope/Startup/zopeschema.xml 1.12 => 1.13 ===
--- Zope/lib/python/Zope/Startup/zopeschema.xml:1.12 Sat Jul 19 23:52:19 2003
+++ Zope/lib/python/Zope/Startup/zopeschema.xml Sun Jul 20 12:22:00 2003
@@ -7,6 +7,7 @@
<import package="zLOG"/>
<import package="ZODB"/>
<import package="ZServer"/>
+ <import package="Products.TemporaryFolder"/>
<sectiontype name="logger" datatype=".LoggerFactory">
<description>