[Zope3-checkins] CVS: Zope3/src/zope/app/process - main.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Tue, 24 Jun 2003 11:21:12 -0400
Update of /cvs-repository/Zope3/src/zope/app/process
In directory cvs.zope.org:/tmp/cvs-serv18686
Modified Files:
Tag: fdrake-zconfig-in-zope-3-branch
main.py
Log Message:
override the ZDOptions hook to locate a default configuration file
=== Zope3/src/zope/app/process/main.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/process/main.py:1.1.2.1 Mon Jun 23 18:07:58 2003
+++ Zope3/src/zope/app/process/main.py Tue Jun 24 11:21:10 2003
@@ -30,6 +30,21 @@
from zope.app.process import event
from zope.server.taskthreads import ThreadedTaskDispatcher
+CONFIG_FILENAME = "zope.conf"
+
+
+class ZopeOptions(zdoptions.ZDOptions):
+
+ def default_configfile(self):
+ dir = os.path.normpath(
+ os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir, os.pardir, os.pardir))
+ for filename in [CONFIG_FILENAME, CONFIG_FILENAME + ".in"]:
+ filename = os.path.join(dir, filename)
+ if os.path.isfile(filename):
+ return filename
+ return None
+
def main(args=None):
# Record start times (real time and CPU time)
@@ -57,7 +72,7 @@
def setup(args=None):
if args is None:
args = sys.argv[1:]
- options = zdoptions.ZDOptions()
+ options = ZopeOptions()
options.schemadir = os.path.dirname(os.path.abspath(__file__))
options.realize(args)
options = options.configroot