From 81e1c42365fc31f7644e4ef3b49aabb6cf2f7174 Mon Sep 17 00:00:00 2001 From: Petar Radosevic Date: Mon, 14 Oct 2013 12:18:53 +0200 Subject: [PATCH] Update SHA method when receiving a number. --- userena/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/userena/utils.py b/userena/utils.py index 130574d6..8695016e 100644 --- a/userena/utils.py +++ b/userena/utils.py @@ -96,6 +96,8 @@ def generate_sha1(string, salt=None): :return: Tuple containing the salt and hash. """ + if not isinstance(string, (str, unicode)): + string = str(string) if not salt: salt = sha_constructor(str(random.random())).hexdigest()[:5] hash = sha_constructor(salt+str(string.encode('utf-8'))).hexdigest()