From ea717b545c5b0930eeef50472b4d47bafc9407e1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 31 May 2006 16:15:10 +0000 Subject: [PATCH] inherited synchronization behavior fixed to descend all the way to the base class --- CHANGES | 2 ++ lib/sqlalchemy/orm/mapper.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index b89461904f..06917f7689 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ 0.2.2 - big improvements to polymorphic inheritance behavior, enabling it to work with adjacency list table structures [ticket:190] +- major fixes and refactorings to inheritance relationships overall, +more unit tests - fixed "echo_pool" flag on create_engine() - fix to docs, removed incorrect info that close() is unsafe to use with threadlocal strategy (its totally safe !) diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 7e77fd6ebd..bde887b2af 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -660,8 +660,16 @@ class Mapper(object): self._setattrbycolumn(obj, col, primary_key[i]) i+=1 self._postfetch(connection, table, obj, c, c.last_inserted_params()) - if self._synchronizer is not None: - self._synchronizer.execute(obj, obj) + + # synchronize newly inserted ids from one table to the next + def sync(mapper): + inherit = mapper.inherits + if inherit is not None: + sync(inherit) + if mapper._synchronizer is not None: + mapper._synchronizer.execute(obj, obj) + sync(self) + self.extension.after_insert(self, connection, obj) def _postfetch(self, connection, table, obj, resultproxy, params): -- 2.47.3