Adding None-guards on the Enum Type

parent 051450b4
Pipeline #652 passed with stages
in 2 minutes and 58 seconds
......@@ -14,8 +14,12 @@ class EnumType(types.TypeDecorator):
super().__init__(*args, **kwargs)
self.__enum__ = enumTable
def process_bind_param(self, value, dialect):
if value is None:
return None
return value.name
def process_result_value(self, value, dialect):
if value is None:
return None
return self.__enum__.__enum__[value]
class EnumColumn(sa.Column):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment