Ensure this fix works without the coercion listener.

This commit is contained in:
Ryan Leckey
2013-11-21 05:14:02 -08:00
parent 05ed87459e
commit bd3bdda1a6

View File

@@ -166,6 +166,10 @@ class PasswordType(types.TypeDecorator, ScalarCoercible):
def process_bind_param(self, value, dialect):
if isinstance(value, Password):
# If were given a password secret; encrypt it.
if value.secret is not None:
return self.context.encrypt(value.secret).encode('utf8')
# Value has already been hashed.
return value.hash