[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - run.py:1.1.2.5

Andreas Jung andreas at andreas-jung.com
Sat May 15 03:54:26 EDT 2004


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

Modified Files:
      Tag: Zope-2_7-branch
	run.py 
Log Message:
temporarily bailing out the ZOPE_CONFIG patch because it breaks some unittests


=== Zope/lib/python/Zope/Startup/run.py 1.1.2.4 => 1.1.2.5 ===
--- Zope/lib/python/Zope/Startup/run.py:1.1.2.4	Fri May 14 08:00:38 2004
+++ Zope/lib/python/Zope/Startup/run.py	Sat May 15 03:54:25 2004
@@ -12,26 +12,24 @@
 #
 ##############################################################################
 
-_zope_opts = None
-
 def run():
     """ Start a Zope instance """
-    from Zope.Startup import start_zope
+    import Zope.Startup
+    starter = Zope.Startup.get_starter()
     opts = _setconfig()
-    start_zope(opts.configroot)
+    starter.setConfiguration(opts.configroot)
+    starter.prepare()
+    starter.run()
 
-def configure(configfile=None):
+def configure(configfile):
     """ Provide an API which allows scripts like zopectl to configure
     Zope before attempting to do 'app = Zope.app(). Should be used as
     follows:  from Zope.Startup.run import configure;
     configure('/path/to/configfile'); import Zope; app = Zope.app() """
-    from Zope.Startup import ZopeStarter
-    if not configfile:
-        import os
-        configfile = os.getenv('ZOPE_CONFIG', None)
-        del os
+    import Zope.Startup
+    starter = Zope.Startup.get_starter()
     opts = _setconfig(configfile)
-    starter = ZopeStarter(opts.configroot)
+    starter.setConfiguration(opts.configroot)
     starter.setupSecurityOptions()
     starter.dropPrivileges()
 
@@ -41,19 +39,17 @@
     where the configuration file exists. """
     from Zope.Startup import options, handlers
     from App import config
-    global _zope_opts
-    if _zope_opts: return _zope_opts
-    _zope_opts = options.ZopeOptions()
+    opts = options.ZopeOptions()
     if configfile:
-        _zope_opts.configfile=configfile
-        _zope_opts.realize(args=[],doc="Sorry, no option docs yet.", 
-                            raise_getopt_errs=0)
+        opts.configfile = configfile
+        opts.realize(doc="Sorry, no option docs yet.", raise_getopt_errs=0)
     else:
-        _zope_opts.realize(doc="Sorry, no option docs yet.")
-    handlers.handleConfig(_zope_opts.configroot, _zope_opts.confighandlers)
+        opts.realize(doc="Sorry, no option docs yet.")
+
+    handlers.handleConfig(opts.configroot, opts.confighandlers)
     import App.config
-    App.config.setConfiguration(_zope_opts.configroot)
-    return _zope_opts
+    App.config.setConfiguration(opts.configroot)
+    return opts
 
 if __name__ == '__main__':
     run()




More information about the Zope-Checkins mailing list