views:

37

answers:

1

Hi, i'm trying to find bug for few hours now but nothing comes out.

Django gives me this error message when i'm trying to access request.SESSION from view. No other errors.

'WSGIRequest' object has no attribute 'SESSION'

Here is my Django settings what points to sessions and authentication. Most of them are set to their defaults.

AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
AUTH_PROFILE_MODULE     = 'alkimikis.users.models.UserProfile'
INSTALLED_APPS          = ['django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.auth', 'django.contrib.admin', 'alkimikis.users']
MIDDLEWARE_CLASSES      = ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware')
SESSION_ENGINE          = 'django.contrib.sessions.backends.db'

Ideas for solution or deeper debugging? Anyone?

+1  A: 

It's request.session. Lower case.

To debug, use the unit test framework. You can then add print statements and see the results.

print request

Very helpful.

S.Lott
OK. No more programming today. Thanks. I think its bad PHP influence.
Anpher
@Anpher: You might want to click the "accept" tick mark if this actually solved your problem.
S.Lott