diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-01-25 09:14:32 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-01-25 09:15:25 -0500 |
commit | 4628a3c71e6e0d883f27baca8496257b4bfd00ef (patch) | |
tree | 0c5df303fb674bc1b70f3f4266b3083d13c0d7f5 | |
parent | 57f324deaf261400d67b07eda114ebc744d47763 (diff) | |
download | sqlalchemy-4628a3c71e6e0d883f27baca8496257b4bfd00ef.tar.gz |
replace "e.g.::" with more context regarding attribute events example
Fixes: #7613
Change-Id: I28a9577587399c41afd53fbd026003667654c3fc
(cherry picked from commit 5e3357c70e419c244156ac3885b2cf784b5b3fc0)
-rw-r--r-- | lib/sqlalchemy/orm/events.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index 3be236e7f..c8b95a4f8 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -2068,7 +2068,8 @@ class AttributeEvents(event.Events): These are typically defined on the class-bound descriptor for the target class. - e.g.:: + For example, to register a listener that will receive the + :meth:`_orm.AttributeEvents.append` event:: from sqlalchemy import event @@ -2079,7 +2080,8 @@ class AttributeEvents(event.Events): Listeners have the option to return a possibly modified version of the value, when the :paramref:`.AttributeEvents.retval` flag is passed to - :func:`.event.listen` or :func:`.event.listens_for`:: + :func:`.event.listen` or :func:`.event.listens_for`, such as below, + illustrated using the :meth:`_orm.AttributeEvents.set` event:: def validate_phone(target, value, oldvalue, initiator): "Strip non-numeric characters from a phone number" |