1.1 --- a/WebStack/Adapters/Django.py Sun Jan 15 23:18:29 2006 +0000
1.2 +++ b/WebStack/Adapters/Django.py Sun Jan 15 23:20:27 2006 +0000
1.3 @@ -23,16 +23,36 @@
1.4 import WebStack.Django
1.5 from WebStack.Generic import EndOfResponse
1.6
1.7 -def respond(request, resource, authenticator=None, handle_errors=1):
1.8 +def deploy(resource, authenticator=None, address=None, handle_errors=1):
1.9 +
1.10 + """
1.11 + Deploy the given 'resource', employing the optional 'authenticator' to
1.12 + protect it. The optional 'handle_errors' parameter (if true) causes handlers
1.13 + to deal with uncaught exceptions cleanly.
1.14 +
1.15 + The optional 'address' parameter is deliberately ignored.
1.16 + """
1.17 +
1.18 + def _deploy(request, *args, **kw):
1.19 + return respond(request, resource, authenticator=authenticator,
1.20 + virtual_path_info=kw.get("vp"), handle_errors=handle_errors)
1.21 + return _deploy
1.22 +
1.23 +def respond(request, resource, authenticator=None, virtual_path_info=None, handle_errors=1):
1.24
1.25 """
1.26 Dispatch to the root application-specific 'resource'. Employ the optional
1.27 - 'authenticator' to control access to the resource. The optional
1.28 - 'handle_errors' parameter (if true) causes handlers to deal with uncaught
1.29 - exceptions cleanly.
1.30 + 'authenticator' to control access to the resource. Define the optional
1.31 + 'virtual_path_info' as the path information considered to belong to the
1.32 + given 'resource'.
1.33 +
1.34 + The optional 'handle_errors' parameter (if true) causes handlers to deal
1.35 + with uncaught exceptions cleanly.
1.36 """
1.37
1.38 trans = WebStack.Django.Transaction(request)
1.39 + if virtual_path_info:
1.40 + trans.set_virtual_path_info(virtual_path_info)
1.41
1.42 try:
1.43 if authenticator is None or authenticator.authenticate(trans):