Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions xsdata/formats/dataclass/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,19 @@ def is_binding_model(self, clazz: type[T]) -> bool:
if not self.class_type.is_model(clazz):
return False

return not self.models_package or (
has_valid_module = (
hasattr(clazz, "__module__")
and isinstance(clazz.__module__, str)
and clazz.__module__.startswith(self.models_package)
and clazz.__module__ in sys.modules
)

if not has_valid_module:
return False

return not self.models_package or clazz.__module__.startswith(
self.models_package
)

def find_types(self, qname: str) -> list[type[T]]:
"""Find all classes that match the given xsi:type qname.

Expand Down
Loading