[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - datatypes.py:1.6.2.4 zopeschema.xml:1.7.2.5

Chris McDonough chrism@zope.com
Sat, 2 Aug 2003 13:57:38 -0400


Update of /cvs-repository/Zope/lib/python/Zope/Startup
In directory cvs.zope.org:/tmp/cvs-serv10434

Modified Files:
      Tag: Zope-2_7-branch
	datatypes.py zopeschema.xml 
Log Message:
Merge from HEAD:

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.



=== Zope/lib/python/Zope/Startup/datatypes.py 1.6.2.3 => 1.6.2.4 ===
--- Zope/lib/python/Zope/Startup/datatypes.py:1.6.2.3	Sat Aug  2 13:02:21 2003
+++ Zope/lib/python/Zope/Startup/datatypes.py	Sat Aug  2 13:57:33 2003
@@ -109,6 +109,13 @@
         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 @@
     """ 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 @@
         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 @@
                               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 @@
                                    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


=== Zope/lib/python/Zope/Startup/zopeschema.xml 1.7.2.4 => 1.7.2.5 ===
--- Zope/lib/python/Zope/Startup/zopeschema.xml:1.7.2.4	Sat Aug  2 13:02:21 2003
+++ Zope/lib/python/Zope/Startup/zopeschema.xml	Sat Aug  2 13:57:33 2003
@@ -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