Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Avoid a crash when unencoding session data for the db backend. This i…

…s required

because some configurations of MySQL (with utf8_bin collation) will return
bytestring, rather than unicode data, which was causing problems previously.

Refs #8340.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 213f294638d353a8763e78e7426ddbea32f0453c 1 parent 97cb07c
Malcolm Tredinnick authored August 23, 2008

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  django/contrib/sessions/backends/db.py
3  django/contrib/sessions/backends/db.py
@@ -3,6 +3,7 @@
3 3
 from django.contrib.sessions.backends.base import SessionBase, CreateError
4 4
 from django.core.exceptions import SuspiciousOperation
5 5
 from django.db import IntegrityError, transaction
  6
+from django.utils.encoding import force_unicode
6 7
 
7 8
 class SessionStore(SessionBase):
8 9
     """
@@ -14,7 +15,7 @@ def load(self):
14 15
                 session_key = self.session_key,
15 16
                 expire_date__gt=datetime.datetime.now()
16 17
             )
17  
-            return self.decode(s.session_data)
  18
+            return self.decode(force_unicode(s.session_data))
18 19
         except (Session.DoesNotExist, SuspiciousOperation):
19 20
             self.create()
20 21
             return {}

0 notes on commit 213f294

Please sign in to comment.
Something went wrong with that request. Please try again.