Commit f26d1eed authored by Chris McDonough's avatar Chris McDonough

New datatype: python_dotted_name, which attempts to resolve a dotted name

to an object but returns the name instead of the object (for values
that should be strings that later resolve to an object during startup).

Fix container-class functionality.  It could be specified in the configuration
but was never actually used.
parent 5192b5ff
......@@ -109,6 +109,13 @@ def importable_name(name):
raise ValueError, (
'The object named by "%s" could not be imported' % name )
# A datatype that ensures that a dotted path name can be resolved but
# returns the name instead of the object
def python_dotted_path(name):
ob = importable_name(name) # will fail in course
return name
# Datatype for the root configuration object
# (adds the softwarehome and zopehome fields; default values for some
# computed paths, configures dbtab)
......@@ -156,7 +163,9 @@ class ZopeDatabase(ZODBDatabase):
""" A ZODB database datatype that can handle an extended set of
attributes for use by DBTab """
container_class = 'OFS.Folder.Folder'
def __init__(self, section):
self.container_class = section.container_class or 'OFS.Folder.Folder'
ZODBDatabase.__init__(self, section)
def createDB(self):
return ZODBDatabase.open(self)
......@@ -166,7 +175,6 @@ class ZopeDatabase(ZODBDatabase):
if self.config.connection_class:
# set the connection class
DB.klass = self.config.connection_class
print DB, DB.klass
if self.config.class_factory is not None:
DB.setClassFactory(self.config.class_factory)
from ZODB.ActivityMonitor import ActivityMonitor
......@@ -234,7 +242,7 @@ def getDefaultDatabaseFactories(context):
pool_size=7, version_pool_size=3,
version_cache_size=100, mount_points=['/'],
connection_class=Connection,
class_factory=None))
class_factory=None, container_class=None))
l.append(main)
......@@ -244,10 +252,11 @@ def getDefaultDatabaseFactories(context):
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')
class_factory=None,
container_class=('Products.TemporaryFolder.'
'TemporaryFolder.'
'SimpleTemporaryContainer')
))
l.append(temporary)
return l
......
......@@ -170,7 +170,7 @@
</description>
</key>
<key name="container-class" datatype=".importable_name">
<key name="container-class" datatype=".python_dotted_path">
<description>
Change the contiainer class a (mounted) database uses on a
per-database basis to support a different container than a plain
......
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