core.orm

Subpackages

Submodules

Package Contents

Functions

find_models(→ Iterator[type[_T]])

Finds the ORM models in the given ORM base class that match a filter.

Attributes

Base

translation_hybrid

core.orm.Base[source]
core.orm.translation_hybrid[source]
core.orm.find_models(base: type[_T], is_match: Callable[[type[_T]], bool]) Iterator[type[_T]][source]

Finds the ORM models in the given ORM base class that match a filter.

The filter is called with each class in the instance and it is supposed to return True if it matches.

For example, find all SQLAlchemy models that use ContentMixin:

from onegov.core.orm.mixins import ContentMixin
find_models(base, is_match=lambda cls: issubclass(cls, ContentMixin))