# HG changeset patch # User paulb # Date 1137367409 0 # Node ID 729d6a2ae0f40dac344a5f484577c4e954ef7238 # Parent 9e2a18a844f5e772e6de56a886a9da10eca1bc8c [project @ 2006-01-15 23:23:03 by paulb] Converted the example to use the deploy function. diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/AuthApp/AuthHandler.py --- a/examples/ModPython/AuthApp/AuthHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/AuthApp/AuthHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,7 +5,7 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from Auth import AuthResource, AuthAuthenticator # NOTE: Not sure if the resource should be maintained in a resource pool. @@ -13,10 +13,6 @@ resource = AuthResource() authenticator = AuthAuthenticator() -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) - -def authenhandler(req): - return ModPython.authenticate(req, authenticator, handle_errors=0) +handler, authenhandler = deploy(resource, authenticator, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/CalendarApp/CalendarHandler.py --- a/examples/ModPython/CalendarApp/CalendarHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/CalendarApp/CalendarHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,7 +5,7 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from Calendar import CalendarResource # NOTE: Not sure if the resource should be maintained in a resource pool. @@ -14,7 +14,6 @@ resource = CalendarResource() #resource = CalendarResource("iso-8859-1") -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/CookiesApp/CookiesHandler.py --- a/examples/ModPython/CookiesApp/CookiesHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/CookiesApp/CookiesHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,14 +5,13 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from Cookies import CookiesResource # NOTE: Not sure if the resource should be maintained in a resource pool. resource = CookiesResource() -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/FormApp/FormHandler.py --- a/examples/ModPython/FormApp/FormHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/FormApp/FormHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,14 +5,13 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from Form import FormResource # NOTE: Not sure if the resource should be maintained in a resource pool. resource = FormResource() -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/LoginApp/LoginHandler.py --- a/examples/ModPython/LoginApp/LoginHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/LoginApp/LoginHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,7 +5,7 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from WebStack.Resources.Login import LoginResource, LoginAuthenticator # NOTE: Not sure if the resource should be maintained in a resource pool. @@ -21,7 +21,6 @@ use_redirect=0 ) -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/SessionsApp/SessionsHandler.py --- a/examples/ModPython/SessionsApp/SessionsHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/SessionsApp/SessionsHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,14 +5,13 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from Sessions import SessionsResource # NOTE: Not sure if the resource should be maintained in a resource pool. resource = SessionsResource() -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/SimpleApp/SimpleHandler.py --- a/examples/ModPython/SimpleApp/SimpleHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/SimpleApp/SimpleHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,14 +5,13 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from Simple import SimpleResource # NOTE: Not sure if the resource should be maintained in a resource pool. resource = SimpleResource() -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/SimpleWithLoginApp/SimpleWithLoginHandler.py --- a/examples/ModPython/SimpleWithLoginApp/SimpleWithLoginHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/SimpleWithLoginApp/SimpleWithLoginHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,14 +5,14 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator from Simple import SimpleResource # NOTE: Not sure if the resource should be maintained in a resource pool. resource = LoginRedirectResource( - login_url="http://localhost/login/app.login", + login_url="http://localhost/login/app", app_url="http://localhost", resource=SimpleResource(), authenticator=LoginRedirectAuthenticator(secret_key="horses"), @@ -21,7 +21,6 @@ use_logout_redirect=0 ) -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/UnicodeApp/UnicodeHandler.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/ModPython/UnicodeApp/UnicodeHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +# NOTE: Path manipulation may require manual customisation. + +import sys, os +sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) + +from WebStack.Adapters.ModPython import deploy +from Simple import SimpleResource + +# NOTE: Not sure if the resource should be maintained in a resource pool. + +resource = UnicodeResource() + +handler, _no_authentication = deploy(resource, handle_errors=0) + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/ModPython/VerySimpleApp/VerySimpleHandler.py --- a/examples/ModPython/VerySimpleApp/VerySimpleHandler.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/ModPython/VerySimpleApp/VerySimpleHandler.py Sun Jan 15 23:23:29 2006 +0000 @@ -5,14 +5,13 @@ import sys, os sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) -from WebStack.Adapters import ModPython +from WebStack.Adapters.ModPython import deploy from VerySimple import VerySimpleResource # NOTE: Not sure if the resource should be maintained in a resource pool. resource = VerySimpleResource() -def handler(req): - return ModPython.respond(req, resource, handle_errors=0) +handler, _no_authentication = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/AuthContext/__init__.py --- a/examples/Webware/AuthContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/AuthContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,13 +4,13 @@ Webware context for the Auth application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from Auth import AuthResource, AuthAuthenticator # NOTE: Initialising a shared resource. resource = AuthResource() authenticator = AuthAuthenticator() -urlParser = WebStackURLParser(resource, authenticator) +urlParser = deploy(resource, authenticator, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/CalendarContext/__init__.py --- a/examples/Webware/CalendarContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/CalendarContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,7 +4,7 @@ Webware context for the Calendar application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from Calendar import CalendarResource # NOTE: Initialising a shared resource. @@ -13,6 +13,6 @@ resource = CalendarResource() #resource = CalendarResource("iso-8859-1") -urlParser = WebStackURLParser(resource) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/CookiesContext/__init__.py --- a/examples/Webware/CookiesContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/CookiesContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,12 +4,12 @@ Webware context for the Cookies application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from Cookies import CookiesResource # NOTE: Initialising a shared resource. resource = CookiesResource() -urlParser = WebStackURLParser(resource) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/FormContext/__init__.py --- a/examples/Webware/FormContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/FormContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,12 +4,12 @@ Webware context for the Form application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from Form import FormResource # NOTE: Initialising a shared resource. resource = FormResource() -urlParser = WebStackURLParser(resource) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/LoginContext/__init__.py --- a/examples/Webware/LoginContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/LoginContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,7 +4,7 @@ Webware context for the Login application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from WebStack.Resources.Login import LoginResource, LoginAuthenticator # NOTE: Initialising a shared resource. @@ -19,6 +19,6 @@ ) ) -urlParser = WebStackURLParser(resource) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/SessionsContext/__init__.py --- a/examples/Webware/SessionsContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/SessionsContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,12 +4,12 @@ Webware context for the Sessions application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from Sessions import SessionsResource # NOTE: Initialising a shared resource. resource = SessionsResource() -urlParser = WebStackURLParser(resource) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/SimpleContext/__init__.py --- a/examples/Webware/SimpleContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/SimpleContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,12 +4,12 @@ Webware context for the Simple application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from Simple import SimpleResource # NOTE: Initialising a shared resource. resource = SimpleResource() -urlParser = WebStackURLParser(resource, handle_errors=0) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/SimpleWithLoginContext/__init__.py --- a/examples/Webware/SimpleWithLoginContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/SimpleWithLoginContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,7 +4,7 @@ Webware context for the Simple application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator from Simple import SimpleResource @@ -18,6 +18,6 @@ anonymous_parameter_name="anonymous", logout_parameter_name="logout" ) -urlParser = WebStackURLParser(resource) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/UnicodeContext/__init__.py --- a/examples/Webware/UnicodeContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/UnicodeContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,12 +4,12 @@ Webware context for the Unicode application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from Unicode import UnicodeResource # NOTE: Initialising a shared resource. resource = UnicodeResource() -urlParser = WebStackURLParser(resource) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 9e2a18a844f5 -r 729d6a2ae0f4 examples/Webware/VerySimpleContext/__init__.py --- a/examples/Webware/VerySimpleContext/__init__.py Sun Jan 15 23:22:13 2006 +0000 +++ b/examples/Webware/VerySimpleContext/__init__.py Sun Jan 15 23:23:29 2006 +0000 @@ -4,12 +4,12 @@ Webware context for the VerySimple application (post Webware 0.8.1). """ -from WebStack.Adapters.Webware import WebStackURLParser +from WebStack.Adapters.Webware import deploy from VerySimple import VerySimpleResource # NOTE: Initialising a shared resource. resource = VerySimpleResource() -urlParser = WebStackURLParser(resource, handle_errors=0) +urlParser = deploy(resource, handle_errors=0) # vim: tabstop=4 expandtab shiftwidth=4