Handle 'sa.Boolean' for 'EncryptedType'
This commit is contained in:
@@ -223,8 +223,12 @@ class EncryptedType(TypeDecorator, ScalarCoercible):
|
|||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Doesn't have 'process_bind_param'
|
# Doesn't have 'process_bind_param'
|
||||||
pass
|
|
||||||
|
|
||||||
|
# Handle 'boolean'
|
||||||
|
if issubclass(self.underlying_type.python_type, bool):
|
||||||
|
value = "true" if value else "false"
|
||||||
|
|
||||||
|
print("encrypt: ", value)
|
||||||
return self.engine.encrypt(value)
|
return self.engine.encrypt(value)
|
||||||
|
|
||||||
def process_result_value(self, value, dialect):
|
def process_result_value(self, value, dialect):
|
||||||
@@ -239,6 +243,12 @@ class EncryptedType(TypeDecorator, ScalarCoercible):
|
|||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Doesn't have 'process_result_value'
|
# Doesn't have 'process_result_value'
|
||||||
|
|
||||||
|
# Handle 'boolean'
|
||||||
|
if issubclass(self.underlying_type.python_type, bool):
|
||||||
|
return decrypted_value == "true"
|
||||||
|
|
||||||
|
# Handle all others
|
||||||
return self.underlying_type.python_type(decrypted_value)
|
return self.underlying_type.python_type(decrypted_value)
|
||||||
|
|
||||||
def _coerce(self, value):
|
def _coerce(self, value):
|
||||||
|
Reference in New Issue
Block a user