Django

Code

Changeset 8507

Show
Ignore:
Timestamp:
08/23/08 17:59:04 (3 months ago)
Author:
mtredinnick
Message:

Avoid a crash when unencoding session data for the db backend. This is required
because some configurations of MySQL (with utf8_bin collation) will return
bytestring, rather than unicode data, which was causing problems previously.

Refs #8340.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/sessions/backends/db.py

    r8381 r8507  
    44from django.core.exceptions import SuspiciousOperation 
    55from django.db import IntegrityError, transaction 
     6from django.utils.encoding import force_unicode 
    67 
    78class SessionStore(SessionBase): 
     
    1516                expire_date__gt=datetime.datetime.now() 
    1617            ) 
    17             return self.decode(s.session_data
     18            return self.decode(force_unicode(s.session_data)
    1819        except (Session.DoesNotExist, SuspiciousOperation): 
    1920            self.create()