changeset 4181:eacb4c9e83e5

Reflect changes to Context-model and Request/Response in wsgiapp
author Florian Krupicka <florian.krupicka@googlemail.com>
date Thu, 19 Jun 2008 17:41:39 +0200
parents 8f3914a83410
children ca0cf44dab89
files MoinMoin/wsgiapp.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wsgiapp.py	Thu Jun 19 17:38:48 2008 +0200
+++ b/MoinMoin/wsgiapp.py	Thu Jun 19 17:41:39 2008 +0200
@@ -30,6 +30,7 @@
 logging = log.getLogger(__name__)
 
 def init(request):
+    request = HTTPContext(request)
     request.clock = Clock()
     request.clock.start('total')
     request.clock.start('base__init__')
@@ -66,7 +67,8 @@
     # parse request data
     try:
         # The last component in path_info is the page name, if any
-        path = request.path_info
+        request.become(HTTPContext)
+        path = request.path
 
         # we can have all action URLs like this: /action/ActionName/PageName?action=ActionName&...
         # this is just for robots.txt being able to forbid them for crawlers
@@ -174,20 +176,17 @@
 
         #return request.finish()
 
-def application(environ, start_response):
-    request = HTTPContext(environ)
+def application(request):
     request = init(request)
     result = run(request)
 
-    response = request.response
-
     if getattr(request, '_send_file', None) is not None:
         # moin wants to send a file (e.g. AttachFile.do_get)
         def simple_wrapper(fileobj, bufsize):
             return iter(lambda: fileobj.read(bufsize), '')
         file_wrapper = environ.get('wsgi.file_wrapper', simple_wrapper)
         response.response = file_wrapper(request._send_file, request._send_bufsize)
-    return response
+    return request
 
-application = responder(application)
+application = Request.application(application)
 application = HTTPExceptionsMiddleware(application)