Beispiel #1
0
def getSchema():
    global _SCHEMA
    if _SCHEMA is None:
        opts = ZopeWSGIOptions()
        opts.load_schema()
        _SCHEMA = opts.schema
    return _SCHEMA
Beispiel #2
0
def getSchema():
    global _SCHEMA
    if _SCHEMA is None:
        opts = ZopeWSGIOptions()
        opts.load_schema()
        _SCHEMA = opts.schema
    return _SCHEMA
Beispiel #3
0
    def configure(self, text):
        # We have to create a directory of our own since the existence
        # of the directory is checked.  This handles this in a
        # platform-independent way.
        config_path = os.path.join(TEMPNAME, 'zope.conf')
        with open(config_path, 'w') as fd:
            fd.write(text.replace(u"<<INSTANCE_HOME>>", TEMPNAME))

        options = ZopeWSGIOptions(config_path)()
        config = options.configroot
        self.assertEqual(config.instancehome, TEMPNAME)
        setConfiguration(config)
Beispiel #4
0
    def configure(self, config):
        # We have to create a directory of our own since the existence
        # of the directory is checked.  This handles this in a
        # platform-independent way.
        config_path = os.path.join(self.TEMPDIR, 'zope.conf')
        with open(config_path, 'w') as fd:
            fd.write(config.format(instance_home=self.TEMPDIR))

        options = ZopeWSGIOptions(config_path)()
        config = options.configroot
        self.assertEqual(config.instancehome, self.TEMPDIR)
        setConfiguration(config)
Beispiel #5
0
def make_wsgi_app(global_config, zope_conf):
    from App.config import setConfiguration
    from Zope2.Startup import get_wsgi_starter
    from Zope2.Startup.handlers import handleWSGIConfig
    from Zope2.Startup.options import ZopeWSGIOptions
    from ZPublisher.WSGIPublisher import publish_module
    starter = get_wsgi_starter()
    opts = ZopeWSGIOptions(configfile=zope_conf)()
    if 'debug_mode' in global_config:
        if global_config['debug_mode'] in ('true', 'on', '1'):
            opts.configroot.debug_mode = True
    handleWSGIConfig(opts.configroot, opts.confighandlers)
    setConfiguration(opts.configroot)
    starter.setConfiguration(opts.configroot)
    starter.prepare()
    return publish_module