]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
clarifies that @reconstructor only applies to a single method 7114/head
authorE. Seiver <5547078+eseiver@users.noreply.github.com>
Wed, 29 Sep 2021 19:25:36 +0000 (12:25 -0700)
committerE. Seiver <5547078+eseiver@users.noreply.github.com>
Wed, 29 Sep 2021 19:25:36 +0000 (12:25 -0700)
doc/build/orm/constructors.rst
lib/sqlalchemy/orm/mapper.py

index 0d8ed471c720f696ab636ae6c6b3fed718dc2fd9..b78b0f0cb97a1788649092058053d7c1f333a630 100644 (file)
@@ -21,7 +21,7 @@ If you need to do some setup on database-loaded instances before they're ready
 to use, there is an event hook known as :meth:`.InstanceEvents.load` which
 can achieve this; it is also available via a class-specific decorator called
 :func:`_orm.reconstructor`.   When using :func:`_orm.reconstructor`,
-the mapper will invoke the decorated method with no
+the mapper will invoke a single decorated method with no
 arguments every time it loads or reconstructs an instance of the
 class. This is
 useful for recreating transient properties that are normally assigned in
@@ -45,7 +45,7 @@ loaded during a :class:`~sqlalchemy.orm.query.Query` operation as in
 ``query(MyMappedClass).one()``, ``init_on_load`` is called.
 
 Any method may be tagged as the :func:`_orm.reconstructor`, even
-the ``__init__`` method itself.    It is invoked after all immediate
+the ``__init__`` method itself, but only one method may be tagged as such.    It is invoked after all immediate
 column-level attributes are loaded as well as after eagerly-loaded scalar
 relationships.  Eagerly loaded collections may be only partially populated
 or not populated at all, depending on the kind of eager loading used.
index 7f111b2374629befb90ec425da0e2e006c8971ff..1aa6666a55c7ab581a9cb73cb003d3d7e026d580 100644 (file)
@@ -3515,7 +3515,7 @@ def _dispose_registries(registries, cascade):
 def reconstructor(fn):
     """Decorate a method as the 'reconstructor' hook.
 
-    Designates a method as the "reconstructor", an ``__init__``-like
+    Designates a single method as the "reconstructor", an ``__init__``-like
     method that will be called by the ORM after the instance has been
     loaded from the database or otherwise reconstituted.