Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 213f294638d353a8763e78e7426ddbea32f0453c 1 parent 97cb07c
@malcolmt malcolmt authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  django/contrib/sessions/backends/
3  django/contrib/sessions/backends/
@@ -3,6 +3,7 @@
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction
+from django.utils.encoding import force_unicode
class SessionStore(SessionBase):
@@ -14,7 +15,7 @@ def load(self):
session_key = self.session_key,
- return self.decode(s.session_data)
+ return self.decode(force_unicode(s.session_data))
except (Session.DoesNotExist, SuspiciousOperation):
return {}

0 comments on commit 213f294

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