changeset 841:47521d9e94bd

Fix unicode bug when setting wiki cookie.
author Brian Neal <bgneal@gmail.com>
date Sat, 04 Oct 2014 17:34:51 -0500
parents 7735f8a6bd1f
children b8c401cf99ca
files wiki/middleware.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/wiki/middleware.py	Sat Oct 04 17:15:22 2014 -0500
+++ b/wiki/middleware.py	Sat Oct 04 17:34:51 2014 -0500
@@ -25,7 +25,8 @@
     # difficult for a spoofer; something that can't be easily made up:
 
     h = hashlib.sha256()
-    h.update(user.username + user.email)
+    h.update(user.username.encode('utf-8'))
+    h.update(user.email.encode('utf-8'))
     h.update(now.isoformat())
     h.update(''.join(random.sample(string.printable, 64)))
     h.update(settings.SECRET_KEY)