Skip to content

Commit 231a098

Browse files
committed
Python 3 preparation: use bytes in anti_csrf_nonce.
1 parent 83d94c2 commit 231a098

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

roundup/cgi/templating.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from roundup import hyperdb, date, support
3030
from roundup import i18n
3131
from roundup.i18n import _
32-
from roundup.anypy.strings import is_us, us2s, s2u, u2s, StringIO
32+
from roundup.anypy.strings import is_us, s2b, us2s, s2u, u2s, StringIO
3333

3434
from .KeywordsExpr import render_keywords_expression_editor
3535

@@ -84,11 +84,11 @@ def anti_csrf_nonce(self, client, lifetime=None):
8484
# include id(self) as the exact location of self (including address)
8585
# is unpredicatable (depends on number of previous connections etc.)
8686
key = '%s%s%s'%(random.random(),id(self),time.time())
87-
key = hashlib.sha256(key).hexdigest()
87+
key = hashlib.sha256(s2b(key)).hexdigest()
8888

8989
while otks.exists(key):
9090
key = '%s%s%s'%(random.random(),id(self),time.time())
91-
key = hashlib.sha256(key).hexdigest()
91+
key = hashlib.sha256(s2b(key)).hexdigest()
9292

9393
# lifetime is in minutes.
9494
if lifetime is None:

0 commit comments

Comments
 (0)