Commit 0468bd8c authored by Emmy Vouriot's avatar Emmy Vouriot Committed by Arnaud Fontaine

remove int cast from bytes with ord()

parent 205bc796
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
from hashlib import md5 from hashlib import md5
import random import random
from Products.ERP5Type.Utils import str2bytes from Products.ERP5Type.Utils import str2bytes
import six
class CaptchasDotNet: class CaptchasDotNet:
def __init__ (self, client, secret, def __init__ (self, client, secret,
...@@ -136,7 +137,8 @@ class CaptchasDotNet: ...@@ -136,7 +137,8 @@ class CaptchasDotNet:
# Compute password # Compute password
correct_password = '' correct_password = ''
for pos in range (password_length): for pos in range (password_length):
letter_num = ord (digest[pos]) % len (password_alphabet) digest_char = ord(digest[pos]) if six.PY2 else digest[pos]
letter_num = digest_char % len (password_alphabet)
correct_password += password_alphabet[letter_num] correct_password += password_alphabet[letter_num]
return correct_password return correct_password
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment