예제 #1
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.ZopeOptions()
     opts.configfile = config_file
     opts.realize(args=[], doc="", raise_getopt_errs=0)
     handlers.handleConfig(opts.configroot, opts.confighandlers)
     App.config.setConfiguration(opts.configroot)
     app = Zope2.app()
     return app
예제 #2
0
파일: run.py 프로젝트: c0ns0le/zenoss-4
def _setconfig(configfile=None):
    """ Configure a Zope instance based on ZopeOptions.  Optionally
    accept a configfile argument (string path) in order to specify
    where the configuration file exists. """
    from Zope2.Startup import options, handlers
    from App import config
    opts = options.ZopeOptions()
    if configfile:
        opts.configfile = configfile
        opts.realize(raise_getopt_errs=0)
    else:
        opts.realize()

    handlers.handleConfig(opts.configroot, opts.confighandlers)
    import App.config
    App.config.setConfiguration(opts.configroot)
    return opts