コード例 #1
0
def _set_wsgi_config(configfile=None):
    """ Configure a Zope instance based on ZopeWSGIOptions.
    Optionally accept a configfile argument (string path) in order
    to specify where the configuration file exists. """
    from Zope2.Startup import options, handlers
    opts = options.ZopeWSGIOptions(configfile=configfile)()
    handlers.handleWSGIConfig(opts.configroot, opts.confighandlers)
    import App.config
    App.config.setConfiguration(opts.configroot)
    return opts
コード例 #2
0
 def get_app(self, config_file=None):
     # given a config file, return a Zope application object
     if config_file is None:
         config_file = self.get_zope_conf()
     from Zope2.Startup import options, handlers
     import App.config
     import Zope2
     opts = options.ZopeWSGIOptions(configfile=config_file)()
     handlers.handleWSGIConfig(opts.configroot, opts.confighandlers)
     App.config.setConfiguration(opts.configroot)
     app = Zope2.app()
     return app