[Zodb-checkins] CVS: Zope3/src/zdaemon - zdoptions.py:1.2
Fred L. Drake, Jr.
fred at zope.com
Wed Jun 25 12:16:33 EDT 2003
Update of /cvs-repository/Zope3/src/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv2631
Modified Files:
zdoptions.py
Log Message:
Merged from fdrake-zconfig-in-zope-3-branch:
Add hook to allow applications to provide a default configuration file
to be used when the user doesn't specify one on the command line.
=== Zope3/src/zdaemon/zdoptions.py 1.1 => 1.2 ===
--- Zope3/src/zdaemon/zdoptions.py:1.1 Thu Jun 19 11:44:34 2003
+++ Zope3/src/zdaemon/zdoptions.py Wed Jun 25 11:16:32 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")
@@ -289,6 +291,16 @@
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:
# Load schema
@@ -301,6 +313,10 @@
self.configroot, self.confighandlers = \
ZConfig.loadConfig(self.schema, self.configfile,
self.zconfig_options)
+
+ # XXX The next two methods aren't any good for Zope 3 (there's no
+ # zLOG package); these need to be re-done to work in the Zope 3
+ # world.
def load_logconf(self, sectname="eventlog"):
parts = sectname.split(".")
More information about the Zodb-checkins
mailing list