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

Method to_python_value

tests/fields/subclass_fields.py:69–76  ·  view source on GitHub ↗
(self, value: Any)

Source from the content-addressed store, hash-verified

67 return value.value
68
69 def to_python_value(self, value: Any) -> Any:
70 if value is None or isinstance(value, self.enum_type):
71 return value
72
73 try:
74 return self.enum_type(value)
75 except ValueError:
76 raise ValueError(f"Database value {value} does not exist on Enum {self.enum_type}.")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected