[Zope3-checkins] CVS: Zope3/src/zdaemon - zdoptions.py:1.1.8.2

Fred L. Drake, Jr. fred@zope.com
Tue, 24 Jun 2003 11:20:08 -0400


Update of /cvs-repository/Zope3/src/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv18476

Modified Files:
      Tag: fdrake-zconfig-in-zope-3-branch
	zdoptions.py 
Log Message:
add a hook to locate a default configuration file


=== Zope3/src/zdaemon/zdoptions.py 1.1.8.1 => 1.1.8.2 ===
--- Zope3/src/zdaemon/zdoptions.py:1.1.8.1	Tue Jun 24 10:48:52 2003
+++ Zope3/src/zdaemon/zdoptions.py	Tue Jun 24 11:20:07 2003
@@ -249,6 +249,8 @@
                 if name and value is not None:
                     setattr(self, name, value)
 
+        if self.configfile is None:
+            self.configfile = self.default_configfile()
         if self.zconfig_options and self.configfile is None:
             self.usage("configuration overrides (-X) cannot be used"
                        " without a configuration file")
@@ -288,6 +290,16 @@
             if (os.getenv("EVENT_LOG_FILE") is None and
                 os.getenv("STUPID_LOG_FILE") is None):
                 self.load_logconf(self.logsectionname)
+
+    def default_configfile(self):
+        """Return the name of the default config file, or None."""
+        # This allows a default configuration file to be used without
+        # affecting the -C command line option; setting self.configfile
+        # before calling realize() makes the -C option unusable since
+        # the realize() thinks it has already seen the option.  If no
+        # -C is used, realize() will call this method to try to locate
+        # a configuration file.
+        return None
 
     def load_schema(self):
         if self.schema is None: