Commit 314a97b9 authored by Chris McDonough's avatar Chris McDonough

Be more careful about specifying a container class: root databases should not...

Be more careful about specifying a container class: root databases should not have a container class.
parent 77cfe590
...@@ -53,6 +53,7 @@ class TestDBConfig: ...@@ -53,6 +53,7 @@ class TestDBConfig:
self.connection_class = Connection self.connection_class = Connection
self.class_factory = None self.class_factory = None
self.storage = DemoStorage(self) self.storage = DemoStorage(self)
self.container_class = None
return ZopeDatabase(self) return ZopeDatabase(self)
def getSectionName(self): def getSectionName(self):
......
...@@ -163,10 +163,6 @@ class ZopeDatabase(ZODBDatabase): ...@@ -163,10 +163,6 @@ class ZopeDatabase(ZODBDatabase):
""" A ZODB database datatype that can handle an extended set of """ A ZODB database datatype that can handle an extended set of
attributes for use by DBTab """ attributes for use by DBTab """
def __init__(self, section):
self.container_class = section.container_class or 'OFS.Folder.Folder'
ZODBDatabase.__init__(self, section)
def createDB(self): def createDB(self):
return ZODBDatabase.open(self) return ZODBDatabase.open(self)
...@@ -214,7 +210,12 @@ class ZopeDatabase(ZODBDatabase): ...@@ -214,7 +210,12 @@ class ZopeDatabase(ZODBDatabase):
""" """
for (virtual_path, real_root, real_path) in self.computeMountPaths(): for (virtual_path, real_root, real_path) in self.computeMountPaths():
if virtual_path == mount_path: if virtual_path == mount_path:
return (real_root, real_path, self.container_class) container_class = self.config.container_class
if not container_class and virtual_path != '/':
# default to OFS.Folder.Folder for nonroot mounts
# if one isn't specified in the config
container_class = 'OFS.Folder.Folder'
return (real_root, real_path, container_class)
raise LookupError('Nothing known about mount path %s' % mount_path) raise LookupError('Nothing known about mount path %s' % mount_path)
def getDefaultDatabaseFactories(context): def getDefaultDatabaseFactories(context):
......
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