django-devserver
django-devserver copied to clipboard
AttributeError: 'WSGIRequest' object has no attribute 'session'
When I remove django.contrib.sessions.middleware.SessionMiddleware then I got next trace:
File "/usr/share/pyshared/django/core/servers/basehttp.py", line 674, in __call__
return self.application(environ, start_response)
File "/usr/share/pyshared/django/core/handlers/wsgi.py", line 245, in __call__
response = middleware_method(request, response)
File "/tmp/python/src/django/devserver/middleware.py", line 32, in process_response
mod.process_response(request, response)
File "/tmp/python/src/django/devserver/modules/request.py", line 23, in process_response
self.logger.info('Session %s authenticated by %s', request.session.session_key, user)
AttributeError: 'WSGIRequest' object has no attribute 'session'
There is a bug at the request.py:
self.has_session = bool(getattr(request, 'session', False))
if self.has_session is not None:
Must be:
self.has_session = bool(getattr(request, 'session', False))
if self.has_session == True:
(I could remove devserver.modules.request.SessionInfoModule of course)