Pylons/webob — Issue #25: wrong argument of wsgify.middleware
Author: aodag
Created: 2012-02-01 17:00:01+00:00
State: open

sample in document::

@wsgify.middleware
def all_caps(app, req):

i wrote very simple dumb middleware::

@wsgify.middleware
def middleware(app, req):
return req.get_response(app)

but i tried simple middleware causes error::

Traceback (most recent call last):
File ".\test_middleware.py", line 14, in
request.get_response(app)
File "C:\Users\aodag\Documents\works\wsgiwiki\lib\site-packages\webob\request.py", line 1149, in get_response
application, catch_exc_info=False)
File "C:\Users\aodag\Documents\works\wsgiwiki\lib\site-packages\webob\request.py", line 1118, in call_application
app_iter = application(self.environ, start_response)
File "C:\Users\aodag\Documents\works\wsgiwiki\lib\site-packages\webob\dec.py", line 132, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "C:\Users\aodag\Documents\works\wsgiwiki\lib\site-packages\webob\dec.py", line 197, in call_func
return self.func(req, *args, **kwargs)
File ".\test_middleware.py", line 6, in middleware
return req.get_response(app)
AttributeError: 'wsgify' object has no attribute 'get_response'

the order of arguments is wrong. in the fact first argument is Request, and second argument is wsgiapp.

OS: Windows 7 64bit
Python: 3.2.2 64bit
WebOb: 1.2b2