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...
1 parent 97cb07c commit 213f294638d353a8763e78e7426ddbea32f0453c @malcolmt malcolmt committed Aug 23, 2008
Showing with 2 additions and 1 deletion.
  1. +2 −1 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.