From be2351481fdb83d1ed02a717ecc7741a19c73f62 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 25 Aug 2014 17:00:21 -0400 Subject: [PATCH] - The "resurrect" ORM event has been removed. This event hook had no purpose since the old "mutable attribute" system was removed in 0.8. fixes #3171 --- doc/build/changelog/changelog_10.rst | 8 ++++++++ lib/sqlalchemy/orm/events.py | 12 ------------ lib/sqlalchemy/orm/mapper.py | 11 ----------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index ace9569602..bff3652c58 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -16,6 +16,14 @@ .. changelog:: :version: 1.0.0 + .. change:: + :tags: bug, orm + :tickets: 3171 + + The "resurrect" ORM event has been removed. This event hook had + no purpose since the old "mutable attribute" system was removed + in 0.8. + .. change:: :tags: bug, sql :tickets: 3169 diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index aa99673bad..8edaa27449 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -293,18 +293,6 @@ class InstanceEvents(event.Events): """ - def resurrect(self, target): - """Receive an object instance as it is 'resurrected' from - garbage collection, which occurs when a "dirty" state falls - out of scope. - - :param target: the mapped instance. If - the event is configured with ``raw=True``, this will - instead be the :class:`.InstanceState` state-management - object associated with the instance. - - """ - def pickle(self, target, state_dict): """Receive an object instance when its associated state is being pickled. diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index f22cac329c..aab28ee0c5 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -1127,7 +1127,6 @@ class Mapper(InspectionAttr): event.listen(manager, 'first_init', _event_on_first_init, raw=True) event.listen(manager, 'init', _event_on_init, raw=True) - event.listen(manager, 'resurrect', _event_on_resurrect, raw=True) for key, method in util.iterate_attributes(self.class_): if isinstance(method, types.FunctionType): @@ -2762,16 +2761,6 @@ def _event_on_init(state, args, kwargs): instrumenting_mapper._set_polymorphic_identity(state) -def _event_on_resurrect(state): - # re-populate the primary key elements - # of the dict based on the mapping. - instrumenting_mapper = state.manager.info.get(_INSTRUMENTOR) - if instrumenting_mapper: - for col, val in zip(instrumenting_mapper.primary_key, state.key[1]): - instrumenting_mapper._set_state_attr_by_column( - state, state.dict, col, val) - - class _ColumnMapping(dict): """Error reporting helper for mapper._columntoproperty.""" -- 2.47.3