If I remove the ClosingIterator stuff from __call__, everything seems to work OK (iow., if I return response(environ, start_response)).
On 15 Sty, 16:48, Jarek Zgoda <[email protected]> wrote: > I'm trying to make some werkzeug-based application (following steps > from tutorial). My view function is: > > from werkzeug import Response > def index(request): > return Response(u'1', mimetype='text/plain') > > I'm getting following traceback on request for the resource. The > traceback is printed to terminal, but no value is returned to client > until I stop the server. > > Traceback (most recent call last): > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 93, in run > self.finish_response() > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 136, in finish_response > self.close() > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/simple_server.py", line 36, in close > SimpleHandler.close(self) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 262, in close > self.result.close() > File "/opt/local/lib/python2.5/site-packages/ > Werkzeug-0.5dev_20090115-py2.5.egg/werkzeug/utils.py", line 1027, in > close > callback() > File "/opt/local/lib/python2.5/site-packages/ > Werkzeug-0.5dev_20090115-py2.5.egg/werkzeug/local.py", line 170, in > cleanup > local.__storage__.pop(ident, None) > AttributeError: 'member_descriptor' object has no attribute 'pop' > ---------------------------------------- > Exception happened during processing of request from ('127.0.0.1', > 49611) > Traceback (most recent call last): > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/SocketServer.py", line 222, in handle_request > self.process_request(request, client_address) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/SocketServer.py", line 241, in process_request > self.finish_request(request, client_address) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/SocketServer.py", line 254, in finish_request > self.RequestHandlerClass(request, client_address, self) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/SocketServer.py", line 522, in __init__ > self.handle() > File "/opt/local/lib/python2.5/site-packages/ > Werkzeug-0.5dev_20090115-py2.5.egg/werkzeug/serving.py", line 87, in > handle > self.get_handler().run(self.server.get_app()) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 96, in run > self.handle_error() > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 309, in handle_error > self.finish_response() > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 134, in finish_response > self.write(data) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 217, in write > self.send_headers() > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 272, in send_headers > if not self.origin_server or self.client_is_modern(): > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/wsgiref/handlers.py", line 285, in client_is_modern > return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' > TypeError: 'NoneType' object is unsubscriptable > ---------------------------------------- > > The application class is untouched one from tutorial, the __call__() > looks like: > > def __call__(self, environ, start_response): > local.application = self > request = Request(environ) > local.url_adapter = adapter = url_map.bind_to_environ(environ) > try: > endpoint, values = adapter.match() > handler = getattr(views, endpoint) > response = handler(request, **values) > except HTTPException, e: > response = e > return ClosingIterator(response(environ, start_response), > [session.remove, local_manager.cleanup]) > > version information: > changeset: 673:603e80a03f8b > tag: tip > user: mitsuhiko > date: Wed Jan 14 15:25:46 2009 +0100 > > Any help? > > Cheers > J. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pocoo-libs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pocoo-libs?hl=en -~----------~----~----~----~------~----~------~--~---
