diff MoinMoin/wsgiapp.py @ 4138:6bbc4beed793

Started with the HTTPContext (currently a reimplementation of request_wsgi with werkzeug)
author Florian Krupicka <florian.krupicka@googlemail.com>
date Thu, 29 May 2008 14:59:41 +0200
parents 719256a8db51
children 049b9aaf3031
line wrap: on
line diff
--- a/MoinMoin/wsgiapp.py	Wed May 28 18:44:22 2008 +0200
+++ b/MoinMoin/wsgiapp.py	Thu May 29 14:59:41 2008 +0200
@@ -3,23 +3,23 @@
     MoinMoin - WSGI application
 
 
-    @copyright: 2001-2003 Juergen Hermann <jh@web.de>,
-                2003-2006 MoinMoin:ThomasWaldmann,
+    @copyright: 2003-2008 MoinMoin:ThomasWaldmann,
                 2008-2008 MoinMoin:FlorianKrupicka
     @license: GNU GPL, see COPYING for details.
 """
-
+from werkzeug.utils import responder
 from werkzeug.wrappers import Response
-from werkzeug.debug import DebuggedApplication
 
-from MoinMoin.web.request import Request
+from MoinMoin.web.contexts import HTTPContext
 
+def application(environ, start_response):
+    request = HTTPContext(environ)
+    request.run()
 
-def application(request):
-    request.run()
     response = Response(status=request.status,
                         headers=request.headers)
-    if request._send_file is not None:
+
+    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), '')
@@ -27,7 +27,7 @@
         response.response = file_wrapper(request._send_file, request._send_bufsize)
     else:
         response.response = request.output()
+        print request.output()
     return response
 
-application = Request.application(application)
-application = DebuggedApplication(application)
+application = responder(application)