]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
- inheriting mappers now inherit the MapperExtensions of their parent
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 20 Dec 2007 02:37:48 +0000 (02:37 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 20 Dec 2007 02:37:48 +0000 (02:37 +0000)
commit2db36bf59c447d4d113cba0ae12f1b739c2ae923
treef623c70981cccb85f02f0f0f0fc638da168fb3cf
parent267523e4da6a6575fae507eabd003e975fc7094f
- inheriting mappers now inherit the MapperExtensions of their parent
mapper directly, so that all methods for a particular MapperExtension
are called for subclasses as well.  As always, any MapperExtension
can return either EXT_CONTINUE to continue extension processing
or EXT_STOP to stop processing.  The order of mapper resolution is:
<extensions declared on the classes mapper> <extensions declared on the
classes' parent mapper> <globally declared extensions>.

Note that if you instantiate the same extension class separately
and then apply it individually for two mappers in the same inheritance
chain, the extension will be applied twice to the inheriting class,
and each method will be called twice.

To apply a mapper extension explicitly to each inheriting class but
have each method called only once per operation, use the same
instance of the extension for both mappers.
[ticket:490]
CHANGES
lib/sqlalchemy/orm/mapper.py
test/orm/mapper.py