martinrusev / django-redis-sessions

Session backend for Django that stores sessions in a Redis database
BSD 3-Clause "New" or "Revised" License
495 stars 106 forks source link

Django 1.4 Compatibility fixes #13

Closed jeffbaier closed 12 years ago

jeffbaier commented 12 years ago

As far as I can tell these are the last things that need fixed to fully work with Django 1.4.

Symptoms: I was running my test suite and tests were failing. Normal web browsing to the site was working, but 'bot' traffic to my site was also failing. Through debugging I found that when using a web browser, session_key was a valid hash, but when using something like curl session_key was None.

Background: In Django 1.4 SessionBase was changed to refuse non-existant user supplied session ids. SessionBase.session_key was made read only. This fix was addressed in issue #9 and pull request #10.

It also made initialization of the session key explicit. We now need to use _get_or_create_session_key() because session_key will not always be populated.

References: https://github.com/django/django/blob/1.4/django/contrib/sessions/backends/cache.py https://github.com/django/django/commit/bda21e2b9d https://code.djangoproject.com/ticket/13478