MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / to_python_value

Method to_python_value

tests/fields/subclass_fields.py:35–42  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

33 return value.value
34
35 def to_python_value(self, value):
36 if value is None or isinstance(value, self.enum_type):
37 return value
38
39 try:
40 return self.enum_type(value)
41 except ValueError:
42 raise ValueError(f"Database value {value} does not exist on Enum {self.enum_type}.")
43
44
45class IntEnumField(IntField):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected