

def setup(host=None, port=None, allow_xhtml=True, propagate=True):
    'Install the WSGI hook for ``host`` and ``port``.\n\n    The default values will be used if host or port are not specified.\n\n    ``allow_xhtml`` enables a workaround for the "not viewer HTML"\n    error when browsing sites that are determined to be XHTML, e.g.\n    featuring xhtml-ish mimetypes.\n\n    Unless ``propagate specifies otherwise``, the\n    ``DEBUG_PROPAGATE_EXCEPTIONS`` will be enabled for better debugging:\n    when using twill, we don\'t really want to see 500 error pages,\n    but rather directly the exceptions that occured on the view side.\n\n    Multiple calls to this function will only result in one handler\n    for each host/port combination being installed.\n    '
    host = (host or DEFAULT_HOST)
    port = (port or DEFAULT_PORT)
    key = (host, port)
    if (not (key in INSTALLED)):
        app = DjangoWsgiFix(AdminMediaHandler(WSGIHandler()))
        twill.add_wsgi_intercept(host, port, (lambda : app))
        browser = get_browser()
        browser.diverged = False
        _enable_xhtml(browser, allow_xhtml)
        if propagate:
            old_propgate_setting = settings.DEBUG_PROPAGATE_EXCEPTIONS
            settings.DEBUG_PROPAGATE_EXCEPTIONS = True
        else:
            old_propgate_setting = None
        INSTALLED[key] = (app, port)
        return browser
    return False

dataset/ETHPy150Open ericholscher/django-test-utils/test_utils/utils/twill_runner.py setup/VarMisuse@143/456 `old_propgate_setting`->`port`