samaras
samaras

Reputation: 344

Return string from web2py CRYPT() function

I am trying to update my auth_user table with


hash = CRYPT()(password)[0]
db(query).update(password=str(hash))

I keep getting a TypeError: character mapping must return integer, None or unicode, which is odd because I did the same thing in another function and got no errors. I am trying to understand what I am doing wrong here

Upvotes: 0

Views: 690

Answers (1)

Anthony
Anthony

Reputation: 25536

Where does the password come from? Looks like it might be a unicode string. You might try

hash = CRYPT()(password.encode('utf8'))[0]

Upvotes: 1

Related Questions