diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-06 03:10:46 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-06 03:10:46 +0000 |
commit | 1644a44628f6a09bb992752bf266994afe0e98df (patch) | |
tree | 515a7c6709fe292af63319d6e1e2ba04349b0bf5 /lib/sqlalchemy/mapping/mapper.py | |
parent | a0079b6831aef2b604859f89f07772e65c04d5d4 (diff) | |
download | sqlalchemy-1644a44628f6a09bb992752bf266994afe0e98df.tar.gz |
a mapper with inheritance will place itself as "dependent" on the inherited mapper; even though this is not usually needed, it allows certain exotic combinations of mapper setups to work (i.e. the one in the polymorph example)
Diffstat (limited to 'lib/sqlalchemy/mapping/mapper.py')
-rw-r--r-- | lib/sqlalchemy/mapping/mapper.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sqlalchemy/mapping/mapper.py b/lib/sqlalchemy/mapping/mapper.py index 7b4595fb0..330c75c31 100644 --- a/lib/sqlalchemy/mapping/mapper.py +++ b/lib/sqlalchemy/mapping/mapper.py @@ -67,9 +67,11 @@ class Mapper(object): self.table = sql.join(inherits.table, table, inherit_condition) self._synchronizer = sync.ClauseSynchronizer(self, self, sync.ONETOMANY) self._synchronizer.compile(self.table.onclause, inherits.tables, TableFinder(table)) + self.inherits = inherits else: self.primarytable = self.table self._synchronizer = None + self.inherits = None # locate all tables contained within the "table" passed in, which # may be a join or other construct @@ -670,13 +672,15 @@ class Mapper(object): except KeyError: return False - def register_dependencies(self, *args, **kwargs): + def register_dependencies(self, uowcommit, *args, **kwargs): """called by an instance of objectstore.UOWTransaction to register which mappers are dependent on which, as well as DependencyProcessor objects which will process lists of objects in between saves and deletes.""" for prop in self.props.values(): - prop.register_dependencies(*args, **kwargs) - + prop.register_dependencies(uowcommit, *args, **kwargs) + if self.inherits is not None: + uowcommit.register_dependency(self.inherits, self) + def register_deleted(self, obj, uow): for prop in self.props.values(): prop.register_deleted(obj, uow) |