Vous avez des améliorations (ou des corrections) à proposer pour ce document :
je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Receive a class and mapper when the :class:`_orm.Mapper` has been
fully constructed.
.. container:: event_signatures
Example argument forms::
from sqlalchemy import event
@event.listens_for(SomeClass, 'after_mapper_constructed')
def receive_after_mapper_constructed(mapper, class_):
"listen for the 'after_mapper_constructed' event"
# ... (event handling logic) ...
This event is called after the initial constructor for
:class:`_orm.Mapper` completes. This occurs after the
:meth:`_orm.MapperEvents.instrument_class` event and after the
:class:`_orm.Mapper` has done an initial pass of its arguments
to generate its collection of :class:`_orm.MapperProperty` objects,
which are accessible via the :meth:`_orm.Mapper.get_property`
method and the :attr:`_orm.Mapper.iterate_properties` attribute.
This event differs from the
:meth:`_orm.MapperEvents.before_mapper_configured` event in that it
is invoked within the constructor for :class:`_orm.Mapper`, rather
than within the :meth:`_orm.registry.configure` process. Currently,
this event is the only one which is appropriate for handlers that
wish to create additional mapped classes in response to the
construction of this :class:`_orm.Mapper`, which will be part of the
same configure step when :meth:`_orm.registry.configure` next runs.
.. versionadded:: 2.0.2
.. seealso::
:ref:`examples_versioning` - an example which illustrates the use
of the :meth:`_orm.MapperEvents.before_mapper_configured`
event to create new mappers to record change-audit histories on
objects.
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :