mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-22 00:56:34 +03:00
fix for bytes
This commit is contained in:
parent
c4ab81ebe1
commit
8ccf87ad04
|
@ -473,7 +473,11 @@ class BaseEnumField(Field):
|
|||
except Exception:
|
||||
return self.enum_cls(value)
|
||||
if isinstance(value, bytes):
|
||||
return self.enum_cls[value.decode('UTF-8')]
|
||||
decoded = value.decode('UTF-8')
|
||||
try:
|
||||
return self.enum_cls[decoded]
|
||||
except Exception:
|
||||
return self.enum_cls(decoded)
|
||||
if isinstance(value, int):
|
||||
return self.enum_cls(value)
|
||||
except (KeyError, ValueError):
|
||||
|
|
Loading…
Reference in New Issue
Block a user