summaryrefslogtreecommitdiff
path: root/passlib/handlers/postgres.py
diff options
context:
space:
mode:
Diffstat (limited to 'passlib/handlers/postgres.py')
-rw-r--r--passlib/handlers/postgres.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/passlib/handlers/postgres.py b/passlib/handlers/postgres.py
index 63e7ddd..c794c19 100644
--- a/passlib/handlers/postgres.py
+++ b/passlib/handlers/postgres.py
@@ -45,7 +45,8 @@ class postgres_md5(uh.HasUserContext, uh.StaticHandler):
# primary interface
#=========================================================
def _calc_checksum(self, secret):
- secret = to_bytes(secret, "utf-8", errname="secret")
+ if isinstance(secret, unicode):
+ secret = secret.encode("utf-8")
user = to_bytes(self.user, "utf-8", errname="user")
return str_to_uascii(md5(secret + user).hexdigest())