changeset 4185:68bcf39ae1d3

General cleanups
author Florian Krupicka <florian.krupicka@googlemail.com>
date Sat, 21 Jun 2008 20:02:17 +0200
parents b4acdce23cfa
children 126559845d4b
files MoinMoin/web/utils.py MoinMoin/wsgiapp.py
diffstat 2 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/utils.py	Sat Jun 21 20:01:54 2008 +0200
+++ b/MoinMoin/web/utils.py	Sat Jun 21 20:02:17 2008 +0200
@@ -156,7 +156,6 @@
 def handle_auth(user_obj, request, attended=False, username=None,
                 password=None, openid_identifier=None, login=None,
                 logout=None, stage=None):
-    logging.warning("handle_auth still needs implementation")
     extra = { 'cookie': request.cookie }
     if login:
         extra['attended'] = attended
--- a/MoinMoin/wsgiapp.py	Sat Jun 21 20:01:54 2008 +0200
+++ b/MoinMoin/wsgiapp.py	Sat Jun 21 20:02:17 2008 +0200
@@ -10,7 +10,7 @@
 from werkzeug.wrappers import Response
 from werkzeug.exceptions import NotFound
 
-from MoinMoin.web.contexts import HTTPContext, RenderContext
+from MoinMoin.web.contexts import HTTPContext, RenderContext, AllContext
 from MoinMoin.web.request import Request
 from MoinMoin.web.utils import check_spider, check_forbidden, check_setuid
 from MoinMoin.web.utils import check_surge_protect, handle_auth_form
@@ -29,7 +29,7 @@
 logging = log.getLogger(__name__)
 
 def init(request):
-    request = HTTPContext(request)
+    request = AllContext(request)
     request.clock.start('total')
     request.clock.start('base__init__')
 
@@ -45,7 +45,6 @@
     check_forbidden(request)
     check_surge_protect(request)
 
-    request.become(RenderContext)
     request.reset()
 
     request.clock.stop('base__init__')
@@ -65,7 +64,6 @@
     # parse request data
     try:
         # The last component in path_info is the page name, if any
-        request.become(HTTPContext)
         path = request.path
 
         # we can have all action URLs like this: /action/ActionName/PageName?action=ActionName&...
@@ -173,17 +171,17 @@
         request.timing_log(False, action_name)
 
         #return request.finish()
+    return request
 
 def application(request):
-    request = init(request)
-    result = run(request)
+    run(init(request))
 
     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)
+        file_wrapper = request.environ.get('wsgi.file_wrapper', simple_wrapper)
+        request.response = file_wrapper(request._send_file, request._send_bufsize)
     return request
 
 application = Request.application(application)