[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - __init__.py:1.2.2.8 datatypes.py:1.2.2.5 handlers.py:1.2.2.7 zopeschema.xml:1.2.2.9

Fred L. Drake, Jr. fred@zope.com
Mon, 24 Feb 2003 15:15:41 -0500


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

Modified Files:
      Tag: new-install-branch
	__init__.py datatypes.py handlers.py zopeschema.xml 
Log Message:
Some simplification: use the datatype instead of handlers when possible.

=== Zope/lib/python/Zope/Startup/__init__.py 1.2.2.7 => 1.2.2.8 ===
--- Zope/lib/python/Zope/Startup/__init__.py:1.2.2.7	Fri Feb 14 17:28:10 2003
+++ Zope/lib/python/Zope/Startup/__init__.py	Mon Feb 24 15:15:41 2003
@@ -108,9 +108,7 @@
         # if we can't lock it.
         # we need a separate lock file because on win32, locks are not
         # advisory, otherwise we would just use the pid file
-        lock_filename = (cfg.lock_filename or
-                         os.path.join(cfg.instance_home, 'var', 'Z2.lock'))
-
+        lock_filename = cfg.lock_filename
         try:
             if os.path.exists(lock_filename):
                 os.unlink(lock_filename)


=== Zope/lib/python/Zope/Startup/datatypes.py 1.2.2.4 => 1.2.2.5 ===
--- Zope/lib/python/Zope/Startup/datatypes.py:1.2.2.4	Fri Feb 21 10:45:49 2003
+++ Zope/lib/python/Zope/Startup/datatypes.py	Mon Feb 24 15:15:41 2003
@@ -65,11 +65,21 @@
         return self.resolved
 
 # Datatype for the root configuration object
-# (adds the softwarehome and zopehome fields)
+# (adds the softwarehome and zopehome fields; default values for some
+#  computed paths)
 
 def root_config(section):
     here = os.path.dirname(os.path.abspath(__file__))
     swhome = os.path.dirname(os.path.dirname(here))
     section.softwarehome = swhome
     section.zopehome = os.path.dirname(os.path.dirname(swhome))
+    if section.clienthome is None:
+        section.clienthome = os.path.join(section.instancehome, "var")
+    # set up defaults for pid_filename and lock_filename if they're
+    # not in the config
+    if section.pid_filename is None:
+        section.pid_filename = os.path.join(section.clienthome, 'Z2.pid')
+    if section.lock_filename is None:
+        section.lock_filename = os.path.join(section.clienthome, 'Z2.lock')
+        print "setting lock_filename =", section.lock_filename
     return section


=== Zope/lib/python/Zope/Startup/handlers.py 1.2.2.6 => 1.2.2.7 ===
--- Zope/lib/python/Zope/Startup/handlers.py:1.2.2.6	Mon Feb 24 14:36:17 2003
+++ Zope/lib/python/Zope/Startup/handlers.py	Mon Feb 24 15:15:41 2003
@@ -17,16 +17,6 @@
         return value + os.sep
     return value
 
-def instance_home(value):
-    value = _append_slash(value)
-    value and _setenv('INSTANCE_HOME', value)
-    return value
-
-def client_home(value):
-    value = _append_slash(value)
-    value and _setenv('CLIENT_HOME', value)
-    return value
-
 def debug_mode(value):
     value and _setenv('Z_DEBUG_MODE', '1')
     return value
@@ -124,11 +114,6 @@
         fixups of values that require knowledge about configuration
         values outside of their context. """
 
-        # set up default for clienthome if it's not in the config
-        if config.clienthome is None:
-            config.clienthome = client_home(
-                os.path.join(config.instancehome, 'var'))
-
         # if no servers are defined, create default http server and ftp server
         if not config.servers:
             import ZServer.datatypes
@@ -145,13 +130,6 @@
         for section in config.servers:
             self.prepare_server(section, config)
 
-
-        # set up defaults for pid_filename and lock_filename if they're
-        # not in the config
-        if config.pid_filename is None:
-            config.pid_filename = os.path.join(config.clienthome, 'Z2.pid')
-        if config.lock_filename is None:
-            config.lock_filename = os.path.join(config.clienthome, 'Z2.lock')
 
         # set up a default root filestorage if there are no root storages
         # mentioned in the config


=== Zope/lib/python/Zope/Startup/zopeschema.xml 1.2.2.8 => 1.2.2.9 ===
--- Zope/lib/python/Zope/Startup/zopeschema.xml:1.2.2.8	Mon Feb 24 14:36:17 2003
+++ Zope/lib/python/Zope/Startup/zopeschema.xml	Mon Feb 24 15:15:41 2003
@@ -30,10 +30,14 @@
   <!-- schema begins  -->
 
   <key name="instancehome" datatype="existing-directory"
-       required="yes" handler="instance_home"/>
+       required="yes">
+    <description>
+      The top-level directory which contains the "instance" of the
+      application server.
+    </description>
+  </key>
 
-  <key name="clienthome" datatype="existing-directory"
-       handler="client_home">
+  <key name="clienthome" datatype="existing-directory">
     <description>
       The directory used to store the file-storage used to back the
       ZODB database by default, as well as other files used by the