Fix serialize_value_for_qml handling of class type
This commit is contained in:
parent
e90312803b
commit
19243ec5a6
|
@ -147,7 +147,8 @@ def serialize_value_for_qml(value: Any, json_list_dicts: bool = False) -> Any:
|
||||||
- For `Sequence` and `Mapping` subclasses (includes `list` and `dict`):
|
- For `Sequence` and `Mapping` subclasses (includes `list` and `dict`):
|
||||||
a JSON dump if `json_list_dicts` is `True`, else the unchanged value
|
a JSON dump if `json_list_dicts` is `True`, else the unchanged value
|
||||||
|
|
||||||
- If the value as a `serialized` attribute or property, return that
|
- If the value is an instancied object and has a `serialized` attribute or
|
||||||
|
property, return that
|
||||||
|
|
||||||
- For `Enum` members, the actual value of the member
|
- For `Enum` members, the actual value of the member
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ def serialize_value_for_qml(value: Any, json_list_dicts: bool = False) -> Any:
|
||||||
if json_list_dicts and isinstance(value, (Sequence, Mapping)):
|
if json_list_dicts and isinstance(value, (Sequence, Mapping)):
|
||||||
return json.dumps(value)
|
return json.dumps(value)
|
||||||
|
|
||||||
if hasattr(value, "serialized"):
|
if not inspect.isclass(value) and hasattr(value, "serialized"):
|
||||||
return value.serialized
|
return value.serialized
|
||||||
|
|
||||||
if hasattr(value, "__class__") and issubclass(value.__class__, Enum):
|
if hasattr(value, "__class__") and issubclass(value.__class__, Enum):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user