view hgpaste/factory.py @ 8:49e931b5c8e2 default tip

encode to bytes for mercurial
author Jeff Hammel <k0scist@gmail.com>
date Tue, 24 Nov 2020 08:53:32 -0800
parents 0dc878f8a15f
children
line wrap: on
line source

__all__ = ['wsgi_app', 'make_app']


def wsgi_app(config_file):
    """wsgi application"""

    if isinstance(config_file, str):
        # Encode to bytes for mercurial API
        config_file = config_file.encode()
    from mercurial import demandimport; demandimport.enable()
    from mercurial.hgweb.hgwebdir_mod import hgwebdir
    application = hgwebdir(config_file)
    return application


def make_app(global_conf, config_file):
    """make an app for paster"""
    return wsgi_app(config_file)