コード例 #1
0
def zopectl_entry(self, arg):
    options = parser.parse_args(arg.split(" ") if arg else [])

    logging.basicConfig(level=logging.INFO)
    make_wsgi_app({}, self.options.configfile)
    app = Zope2.app()
    verify_zodb(app._p_jar._db._storage, debug=options.debug)
コード例 #2
0
ファイル: zopewsgi.py プロジェクト: dwtcourses/erp5
def runwsgi():
    parser = argparse.ArgumentParser()
    parser.add_argument('-w', '--webdav', action='store_true')
    parser.add_argument('address', help='<ip>:<port>')
    parser.add_argument('zope_conf', help='path to zope.conf')
    args = parser.parse_args()

    startup = os.path.dirname(Zope2.Startup.__file__)
    schema = ZConfig.loadSchema(os.path.join(startup, 'zopeschema.xml'))
    conf, _ = ZConfig.loadConfig(schema, args.zope_conf)

    make_wsgi_app({}, zope_conf=args.zope_conf)

    from Signals.SignalHandler import SignalHandler
    SignalHandler.registerHandler(signal.SIGTERM, sys.exit)

    ip, port = splitport(args.address)
    port = int(port)
    createServer(
        app_wrapper(
          large_file_threshold=conf.large_file_threshold,
          webdav_ports=[port] if args.webdav else ()),
        listen=args.address,
        logger=logging.getLogger("access"),
        threads=conf.zserver_threads,
    ).run()
コード例 #3
0
def runscript(zopeconf, script_name, *extra_args):
    make_wsgi_app({}, zopeconf)
    app = Zope2.app()
    app = makerequest(app)
    app.REQUEST['PARENTS'] = [app]
    setRequest(app.REQUEST)
    newSecurityManager(None, user)
    scriptglobals = {'__name__': '__main__', 'app': app}
    with open(script_name) as script:
        scriptcode = script.read()
    exec(compile(scriptcode, script_name, 'exec'), scriptglobals)
コード例 #4
0
ファイル: verifydb.py プロジェクト: zopyx/Products.CMFPlone
def zopectl_entry(self, arg):
    parser = argparse.ArgumentParser(
        prog=sys.argv[0] + ' verifydb',
        description='Verifies that all records in the database can be loaded.',
    )
    parser.add_argument(
        '-D', '--debug', action='store_true', dest='debug',
        help='pause to debug broken pickles')
    options = parser.parse_args(arg.split(' ') if arg else [])

    logging.basicConfig(level=logging.INFO)
    make_wsgi_app({}, self.options.configfile)
    app = Zope2.app()
    verify_zodb(app, debug=options.debug)
コード例 #5
0
ファイル: verifydb.py プロジェクト: rexzing/Products.CMFPlone
def zopectl_entry(self, arg):
    parser = argparse.ArgumentParser(
        prog=sys.argv[0] + ' verifydb',
        description='Verifies that all records in the database can be loaded.',
    )
    parser.add_argument('-D',
                        '--debug',
                        action='store_true',
                        dest='debug',
                        help='pause to debug broken pickles')
    options = parser.parse_args(arg.split(' ') if arg else [])

    logging.basicConfig(level=logging.INFO)
    make_wsgi_app({}, self.options.configfile)
    app = Zope2.app()
    verify_zodb(app, debug=options.debug)
コード例 #6
0
def runwsgi():
    parser = argparse.ArgumentParser()
    parser.add_argument('-w', '--webdav', action='store_true')
    parser.add_argument('address', help='<ip>:<port>')
    parser.add_argument('zope_conf', help='path to zope.conf')
    parser.add_argument('--timerserver-interval',
                        help='Interval for timerserver',
                        type=float)
    args = parser.parse_args()

    startup = os.path.dirname(Zope2.Startup.__file__)
    schema = ZConfig.loadSchema(os.path.join(startup, 'zopeschema.xml'))
    conf, _ = ZConfig.loadConfig(schema, args.zope_conf)

    make_wsgi_app({}, zope_conf=args.zope_conf)

    if six.PY2:
        from Signals.SignalHandler import SignalHandler
        SignalHandler.registerHandler(signal.SIGTERM, sys.exit)
    else:
        import warnings
        warnings.warn("zope4py3: SignalHandling not implemented!")

    if args.timerserver_interval:
        import Products.TimerService
        Products.TimerService.timerserver.TimerServer.TimerServer(
            module='Zope2',
            interval=args.timerserver_interval,
        )

    ip, port = splitport(args.address)
    port = int(port)
    createServer(
        app_wrapper(large_file_threshold=conf.large_file_threshold,
                    webdav_ports=[port] if args.webdav else ()),
        listen=args.address,
        logger=logging.getLogger("access"),
        threads=conf.zserver_threads,
        asyncore_use_poll=True,
        # Prevent waitress from adding its own Via and Server response headers.
        ident=None,
    ).run()
コード例 #7
0
def waitress_main(args=None):
    """
    Configure + start Plone behind waitress from the given PasteDeploy
    configuration
    Waitress - unlike uwsgi - expects us to do the
    PasteDeploy stuff on our own.
    """
    ini_filename = args[-1]
    config_loader = ConfigLoader(ini_filename)
    server_config = config_loader.get_context(SERVER)
    serve = server_config.create()
    app_config = config_loader.get_context(APP)
    zope_conf = app_config.local_conf['zope_conf']
    wsgiapp = make_wsgi_app(app_config.global_conf, zope_conf)
    serve(wsgiapp)
コード例 #8
0
def app_factory(global_config, instances):
    instances_config = {}
    for line in instances.split('\n'):
        if not line.strip():
            continue

        name, address, zope_conf = line.strip().split()
        instances_config[name] = {
            'address': address,
            'zope_conf': zope_conf
        }

    for instance in instances_config.values():
        if is_listening(instance['address']):
            continue
        
        return make_wsgi_app(global_config, instance['zope_conf'])

    raise Exception('Failure to create worker')
コード例 #9
0
def debug(zopeconf):
    make_wsgi_app({}, zopeconf)
    print('Starting debugger (the name "app" is bound to the top-level '
          'Zope object)')
    return Zope2.app()
コード例 #10
0
def debug(zopeconf):
    make_wsgi_app({}, zopeconf)
    return Zope2.app()
コード例 #11
0
ファイル: test.py プロジェクト: pjstevns/plone.mongrel2
from Zope2.Startup.run import make_wsgi_app
conf = "/home/paul/plonewsgi/parts/plone/etc/zope.conf"
application = make_wsgi_app(None, conf)