view MoinMoin/support/flup/server/paste_factory.py @ 4303:eb463542664e

Move flup also to support (now that it's added to path we can just ship it)
author Florian Krupicka <florian.krupicka@googlemail.com>
date Thu, 14 Aug 2008 00:59:13 +0200
parents contrib/flup-server/flup/server/paste_factory.py@d40461b9ee6c
children 6049883eb89e
line wrap: on
line source
def helper(wsgiServerClass, global_conf, host, port, **local_conf):
    # I think I can't write a tuple for bindAddress in .ini file
    host = host or global_conf.get('host', 'localhost')
    port = port or global_conf.get('port', 4000)

    if 'socket' in local_conf:
        local_conf['bindAddress'] = local_conf['socket']
        del local_conf['socket']
    else:
        local_conf['bindAddress'] = (host, int(port))
    
    def server(application):
        server = wsgiServerClass(application, **local_conf)
        server.run()

    return server