From f2fff84bc3e85b9c9c132dec614e8b293df8f6bb Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Wed, 15 Aug 2012 14:19:53 +0200 Subject: [PATCH] [py3] fixed session file backend. --- django/contrib/sessions/backends/file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/contrib/sessions/backends/file.py b/django/contrib/sessions/backends/file.py index 0f869088ac..cc6fcdb045 100644 --- a/django/contrib/sessions/backends/file.py +++ b/django/contrib/sessions/backends/file.py @@ -5,6 +5,7 @@ import tempfile 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 @@ class SessionStore(SessionBase): renamed = False try: try: - os.write(output_file_fd, self.encode(session_data)) + os.write(output_file_fd, self.encode(session_data).encode()) finally: os.close(output_file_fd) os.rename(output_file_name, session_file_name)