From a7496789d9b2bcb752c47b597f901d14b77ac614 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Apr 2015 15:34:36 +0200 Subject: Port session to Python 3 md5() requires bytes: on Python 3, encode text to utf-8 --- paste/session.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paste/session.py b/paste/session.py index 133cad6..ae208e7 100644 --- a/paste/session.py +++ b/paste/session.py @@ -148,7 +148,10 @@ class SessionFactory(object): r.append(os.times()) if for_object is not None: r.append(id(for_object)) - md5_hash = md5(str(r)) + content = str(r) + if six.PY3: + content = content.encode('utf8') + md5_hash = md5(content) try: return md5_hash.hexdigest() except AttributeError: -- cgit v1.2.1