Exemple #1
0
def manage_isapi():
    # If run from the command-line, install ourselves.
    from isapi.install import ISAPIParameters, ScriptMapParams, VirtualDirParameters, HandleCommandLine
    params = ISAPIParameters()
    # Setup the virtual directories - this is a list of directories our
    # extension uses - in this case only 1.
    # Each extension has a "script map" - this is the mapping of ISAPI
    # extensions.
    sm = [ScriptMapParams(Extension="*", Flags=0)]
    vd = VirtualDirParameters(Name="isapi-openid",
                              Description="ISAPI-WSGI OpenID Provider",
                              ScriptMaps=sm,
                              ScriptMapUpdate="replace")
    params.VirtualDirs = [vd]
    HandleCommandLine(params)
Exemple #2
0
def main():
    parser = OptionParser(usage='%prog [options] install | remove',
                          prog=program_name())
    parser.add_option('-d', '--debug', action='store_true')
    parser.add_option('-m',
                      '--module',
                      dest='module',
                      help='use application module:classname')
    parser.set_default('debug', False)
    opts, args = parser.parse_args()
    sys.argv[1:] = args
    if not opts.module:
        parser.error('you need to specify --module')
    mobj = re_module.match(opts.module)
    if not mobj:
        parser.error('specify --module as module:classname')
    opts.modname = mobj.group(1)
    opts.classname = mobj.group(2)
    module = import_module(opts.modname)
    if module is None:
        parser.error('could not load module %s' % modname)
    if not hasattr(module, opts.classname):
        parser.error('could not load class %s from module' % opts.classname)
    params = ISAPIParameters()
    sm = ScriptMapParams(Extension='*', Flags=0)
    vd = VirtualDirParameters(Name='api',
                              Headers=None,
                              Description='python-rest',
                              ScriptMaps=[sm],
                              ScriptMapUpdate='replace')
    params.VirtualDirs = [vd]
    # A DLL with the name _filename.dll is installed in the same directory as
    # the handler file.
    fname = inspect.getfile(module)
    dname, fname = os.path.split(fname)
    fname, ext = os.path.splitext(fname)
    fname = os.path.join(dname, '_%s_isapi.py' % fname)
    create_isapi_handler(fname, opts)
    HandleCommandLine(params, conf_module_name=fname)
    # Fix up some common errors
    create_egg_cache(eggdir)
    dir = os.path.join(sys.exec_prefix, 'Lib', 'site-packages')
    fix_egg_permissions(dir)
    update_web_config(webroot)
Exemple #3
0
def __ExtensionFactory__():
    ##    from paste.deploy import loadapp
    ##     from paste.script.util.logging_config import fileConfig

    # <INSTALLDIR>\config\mapproxy.yaml
    yaml_file = os.path.abspath(
        os.path.join(mapproxy_root_dir, r'config', r'mapproxy.yaml'))

    from mapproxy.wsgiapp import make_wsgi_app
    # application = make_wsgi_app(r'C:\mapproxy\mapproxy.yaml')
    application = make_wsgi_app(yaml_file)

    import isapi_wsgi
    return isapi_wsgi.ISAPIThreadPoolHandler(application)


# ISAPI installation
if __name__ == '__main__':
    from isapi.install import ISAPIParameters, ScriptMapParams, VirtualDirParameters, HandleCommandLine

    params = ISAPIParameters()
    sm = [ScriptMapParams(Extension="*", Flags=0)]

    vd = VirtualDirParameters(Name="mapproxy",
                              Description="MapProxy",
                              ScriptMaps=sm,
                              ScriptMapUpdate="replace")

    params.VirtualDirs = [vd]
    HandleCommandLine(params)
# The entry point for the ISAPI extension.
def __ExtensionFactory__():
    import os
    import sys
    path = os.path.dirname(os.path.abspath(__file__))
    os.chdir(path)
    sys.path = [path]+[p for p in sys.path if not p==path]
    import gluon.main
    import isapi_wsgi
    application=gluon.main.wsgibase
    return isapi_wsgi.ISAPIThreadPoolHandler(application)

# ISAPI installation:
if __name__=='__main__':
    from isapi.install import ISAPIParameters
    from isapi.install import ScriptMapParams
    from isapi.install import VirtualDirParameters
    from isapi.install import HandleCommandLine

    params = ISAPIParameters()
    sm = [
       ScriptMapParams(Extension="*", Flags=0)
    ]
    vd = VirtualDirParameters(Name="appname",
                              Description = "Web2py in Python",
                              ScriptMaps = sm,
                              ScriptMapUpdate = "replace")
    params.VirtualDirs = [vd]
    HandleCommandLine(params)

Exemple #5
0
isapi_wsgi.IsapiWsgiHandler = WsgiHandler

# Only create the hgwebdir instance once
application = hgwebdir(hgweb_config)


def handler(environ, start_response):

    # Translate IIS's weird URLs
    url = environ['SCRIPT_NAME'] + environ['PATH_INFO']
    paths = url[1:].split('/')[path_strip:]
    script_name = '/' + '/'.join(paths[:path_prefix])
    path_info = '/'.join(paths[path_prefix:])
    if path_info:
        path_info = '/' + path_info
    environ['SCRIPT_NAME'] = script_name
    environ['PATH_INFO'] = path_info

    return application(environ, start_response)


def __ExtensionFactory__():
    return isapi_wsgi.ISAPISimpleHandler(handler)


if __name__ == '__main__':
    from isapi.install import ISAPIParameters, HandleCommandLine
    params = ISAPIParameters()
    HandleCommandLine(params)
if __name__ == '__main__':

    from omeroweb import settings
    static_prefix = settings.STATIC_URL.rstrip("/")
    try:
        web_prefix = settings.FORCE_SCRIPT_NAME.rstrip("/")
    except:
        web_prefix = "/omero"
    permit_iis(CONFIG)
    permit_iis(LOGS)

    # If run from the command-line, install ourselves.
    from isapi.install import ISAPIParameters, ScriptMapParams
    from isapi.install import VirtualDirParameters, HandleCommandLine
    params = ISAPIParameters()
    # Setup the virtual directories - this is a list of directories our
    # extension uses - in this case only 2.
    # The OMERO.web application extension has a "script map" - this is the
    # mapping of ISAPI extensions.
    sm = [
        ScriptMapParams(Extension="*", Flags=0)
    ]
    vd1 = VirtualDirParameters(Name=web_prefix,
                               Description="ISAPI-WSGI OMERO.web",
                               ScriptMaps=sm,
                               ScriptMapUpdate="replace"
                               )
    vd2 = VirtualDirParameters(Name=static_prefix,
                               Description="OMERO.web static files",
                               Path=STATICS,