Browse files

[py3] fixed session file backend.

  • Loading branch information...
1 parent 4d393e1 commit f2fff84bc3e85b9c9c132dec614e8b293df8f6bb @apollo13 apollo13 committed Aug 15, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 django/contrib/sessions/backends/
3 django/contrib/sessions/backends/
@@ -5,6 +5,7 @@
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
+from django.utils.encoding import smart_bytes
class SessionStore(SessionBase):
@@ -115,7 +116,7 @@ def save(self, must_create=False):
renamed = False
- os.write(output_file_fd, self.encode(session_data))
+ os.write(output_file_fd, self.encode(session_data).encode())
dreynolds added a line comment Jun 29, 2016

Is it possible to get an explanation of what this fixes exactly? The commit message is not totally clear and this line is causing some issues for me.

Django member
apollo13 added a line comment Jun 29, 2016

We need to ensure that we write bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
os.rename(output_file_name, session_file_name)

2 comments on commit f2fff84

Django member

I guess the smart_bytes import is a remainder of trials?

Django member

Guessed right, will fix it.

Please sign in to comment.