diff options
| author | ianb <devnull@localhost> | 2005-05-16 03:51:36 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-05-16 03:51:36 +0000 |
| commit | c1a903447ca6fe5b3e0138de252ecee42691f355 (patch) | |
| tree | 654bce02a230955ff6e934a8c8f5680021c94d70 /paste/webkit | |
| parent | c552be340632df607536f4db4507d059f46ddcf4 (diff) | |
| download | paste-c1a903447ca6fe5b3e0138de252ecee42691f355.tar.gz | |
Removed now-redundant modules
Diffstat (limited to 'paste/webkit')
| -rw-r--r-- | paste/webkit/test_wkfixture.py | 66 | ||||
| -rw-r--r-- | paste/webkit/wsgiwebkit.py | 67 |
2 files changed, 0 insertions, 133 deletions
diff --git a/paste/webkit/test_wkfixture.py b/paste/webkit/test_wkfixture.py deleted file mode 100644 index 790a099..0000000 --- a/paste/webkit/test_wkfixture.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Test fixture for Paste/WebKit testing. - -Maybe look at paste.tests.fixture as an alternative to this -""" - -from cStringIO import StringIO -from paste import recursive -from paste import session -from paste import httpexceptions -from paste import lint -from paste import wsgilib - -_default_environ = { - 'SCRIPT_NAME': '', - 'SERVER_NAME': 'localhost', - 'SERVER_PORT': '80', - 'REQUEST_METHOD': 'GET', - 'HTTP_HOST': 'localhost:80', - 'CONTENT_LENGTH': '0', - 'wsgi.input': StringIO(''), - 'wsgi.version': (1, 0), - 'wsgi.multithread': False, - 'wsgi.multiprocess': False, - 'wsgi.run_once': False, -} - -def stack(application): - """ - Creates a WebKit stack, except with a fixed application and - no URLParser. - """ - return recursive.middleware( - lint.middleware( - httpexceptions.middleware( - lint.middleware( - session.middleware( - lint.middleware(application)))))) - -def in_request(application, **kw): - """ - Used to wrap a function in an application invokation, used like:: - - @in_request(my_app, path_info='/whatever', - wsgi__input='post-data', - REQUEST_METHOD='POST') - def test_this(output, **kw): - assert 'I got post-data' in output - - The wrapped function received several keyword arguments, and in - the future there may be more, so a **kw is required so that - extra arguments may be ignored. - """ - def decorator(func): - def replacement_func(*inner_args, **inner_kw): - # Note, *inner_args and **inner_kw are intended for use - # with @param or other py.test parameterizers - app = stack(application) - status, headers, output, errors = wsgilib.raw_interactive( - app, **kw) - return func(status=status, headers=headers, output=output, - errors=errors, application=application, - *inner_args, - **inner_kw) - return replacement_func - return decorator diff --git a/paste/webkit/wsgiwebkit.py b/paste/webkit/wsgiwebkit.py deleted file mode 100644 index f7ee40f..0000000 --- a/paste/webkit/wsgiwebkit.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -wkserver constructs the WSGI stack of middleware to serve WebKit -content. It actually does not include a server (umm... bad name; -"application" was taken). - -Use ``some_server(webkit('/path/to/servlets/'))`` -""" - -import sys -import os -from paste import urlparser -from paste import session -from paste import recursive -from paste import httpexceptions -from paste import lint -from paste import error_middleware - -def webkit(directory, install_fake_webware=True, use_lint=False): - if install_fake_webware: - _install_fake_webware() - app = urlparser.URLParser(directory, os.path.basename(directory)) - if use_lint: - app = lint.middleware(app) - app = httpexceptions.middleware(app) - if use_lint: - app = lint.middleware(app) - app = session.SessionMiddleware(app) - if use_lint: - app = lint.middleware(app) - app = recursive.RecursiveMiddleware(app) - if use_lint: - app = lint.middleware(app) - app = error_middleware.ErrorMiddleware(app) - # I'll skip the use of lint on recursive, because it doesn't modify - # its output much at all - return app - -def install_fake_webware(): - fake_webware_dir = os.path.join(os.path.dirname(__file__), - 'FakeWebware') - if fake_webware_dir in sys.path: - return - sys.path.insert(0, fake_webware_dir) -_install_fake_webware = install_fake_webware - -if __name__ == '__main__': - if os.environ.has_key('SERVER_NAME'): - import cgiserver - cgiserver.run_with_cgi(webkit(os.path.dirname(__file__)), - use_cgitb=True, - redirect_stdout=True) - else: - import wsgilib - import sys - import os - if '-h' in sys.argv or '--help' in sys.argv or not sys.argv[1:]: - print 'Usage: %s URL_PATH' % sys.argv[0] - print 'Run like: CLIENT_DIR=XXX %s URL_PATH' % sys.argv[0] - print 'to put the root of the URL_PATH in in XXX' - sys.exit() - root = os.environ.get('CLIENT_DIR', os.path.dirname(__file__)) - application = webkit(root) - def prapp(url, app=None): - if app is None: - app = application - print wsgilib.interactive(app, url) - prapp(sys.argv[1]) |
