]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Remove MappedCollection converter; deprecate @converter
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 26 Sep 2018 22:52:44 +0000 (18:52 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Sep 2018 19:43:51 +0000 (15:43 -0400)
commitfe8ddb71d98f9f8b5e8e5bcf54b4208a1dfad2fd
treeb82d4ded4537a81d8c3b2325077f9c950ce1dde7
parent54768815c6471c4378c5ac57aa7090c68dc079dd
Remove MappedCollection converter; deprecate @converter

Removed the collection converter used by the :class:`.MappedCollection`
class. This converter was used only to assert that the incoming dictionary
keys matched that of their corresponding objects, and only during a bulk set
operation.  The converter can interfere with a custom validator or
:meth:`.AttributeEvents.bulk_replace` listener that wants to convert
incoming values further.  The ``TypeError`` which would be raised by this
converter when an incoming key didn't match the value is removed; incoming
values during a bulk assignment will be keyed to their value-generated key,
and not the key that's explicitly present in the dictionary.

Overall, @converter is superseded by the
:meth:`.AttributeEvents.bulk_replace` event handler added as part of
:ticket:`3896`.

Fixes: #3604
Change-Id: Id0f7bd2cec938f5975eb2ab94df9ba5754dd43c3
doc/build/changelog/unreleased_13/3604.rst [new file with mode: 0644]
lib/sqlalchemy/orm/collections.py
test/orm/test_collection.py
test/orm/test_validators.py