'WSGIRequest' object has no attribute 'session' - error trying to integrate askbot with our own django app
Currently getting the following error when moving between askbot pages and our own django app:
'WSGIRequest' object has no attribute 'session'
with traceback ending at
/usr/local/lib/python2.6/dist-packages/Django-1.3.1-py2.6.egg/django/contrib/auth/__init__.py in get_user
107. user_id = request.session[SESSION_KEY]
Suspect this is because askbot is using different session middleware to our own - any ideas?
Minimal repro is: go to askbot section of our site (not logged in), click on "log in" link.
here is our MIDDLEWARE_CLASSES
from settings.py
:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'askbot.middleware.view_log.ViewLogMiddleware',
'askbot.middleware.spaceless.SpacelessMiddleware')
as far as I can tell, this is merged correctly with the askbot settings.py...
Comments
aha! the exact ordering of the MIDDLEWARE_CLASSES matters!
It does, we'll need to add checks on the middleware order to the startup tests. Did you change order of the first two? Is the problem fixed?