changeset 5440:60535a4822ab

Python 3 preparation: use bytes in anti_csrf_nonce.
author Joseph Myers <jsm@polyomino.org.uk>
date Wed, 25 Jul 2018 11:44:49 +0000
parents b00cd44fea16
children a14c0e652e25
files roundup/cgi/templating.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Wed Jul 25 11:44:01 2018 +0000
+++ b/roundup/cgi/templating.py	Wed Jul 25 11:44:49 2018 +0000
@@ -29,7 +29,7 @@
 from roundup import hyperdb, date, support
 from roundup import i18n
 from roundup.i18n import _
-from roundup.anypy.strings import is_us, us2s, s2u, u2s, StringIO
+from roundup.anypy.strings import is_us, s2b, us2s, s2u, u2s, StringIO
 
 from .KeywordsExpr import render_keywords_expression_editor
 
@@ -84,11 +84,11 @@
     # include id(self) as the exact location of self (including address)
     # is unpredicatable (depends on number of previous connections etc.)
     key = '%s%s%s'%(random.random(),id(self),time.time())
-    key = hashlib.sha256(key).hexdigest()
+    key = hashlib.sha256(s2b(key)).hexdigest()
 
     while otks.exists(key):
         key = '%s%s%s'%(random.random(),id(self),time.time())
-        key = hashlib.sha256(key).hexdigest()
+        key = hashlib.sha256(s2b(key)).hexdigest()
 
     # lifetime is in minutes.
     if lifetime is None:

Roundup Issue Tracker: http://roundup-tracker.org/