From: Mike Bayer Date: Thu, 1 Feb 2007 21:38:16 +0000 (+0000) Subject: - clear_mappers() just blows away all of ArgSingleton for now X-Git-Tag: rel_0_3_5~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4247ef92a8a33506458f9b2f4977753c08a6e94;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - clear_mappers() just blows away all of ArgSingleton for now - lazy clause goes against parent.mapped_table instead of parent.local_table, helps it to recognize self-referential condition between a descendant joined-table-inheritance mapper --- diff --git a/lib/sqlalchemy/orm/__init__.py b/lib/sqlalchemy/orm/__init__.py index a933cb1b27..3fab0e63e5 100644 --- a/lib/sqlalchemy/orm/__init__.py +++ b/lib/sqlalchemy/orm/__init__.py @@ -9,6 +9,7 @@ the mapper package provides object-relational functionality, building upon the s packages and tying operations to class properties and constructors. """ from sqlalchemy import exceptions +from sqlalchemy import util as sautil from sqlalchemy.orm.mapper import * from sqlalchemy.orm import mapper as mapperlib from sqlalchemy.orm.query import Query @@ -74,10 +75,10 @@ def clear_mappers(): when new mappers are created, they will be assigned to their classes as their primary mapper.""" for mapper in mapper_registry.values(): attribute_manager.reset_class_managed(mapper.class_) - mapper.class_key.dispose() if hasattr(mapper.class_, 'c'): del mapper.class_.c mapper_registry.clear() + sautil.ArgSingleton.instances.clear() def clear_mapper(m): """remove the given mapper from the storage of mappers. diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 1cdf0b177e..19868ba132 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -156,7 +156,7 @@ class LazyLoader(AbstractRelationLoader): def init(self): super(LazyLoader, self).init() (self.lazywhere, self.lazybinds, self.lazyreverse) = self._create_lazy_clause( - self.parent.local_table, + self.parent.mapped_table, self.mapper.select_table, self.polymorphic_primaryjoin, self.polymorphic_secondaryjoin, @@ -250,7 +250,7 @@ class LazyLoader(AbstractRelationLoader): binds = {} reverse = {} - #print "PARENTTABLE", parenttable, "TARGETTABLE", targettable + #print "PARENTTABLE", parenttable, "TARGETTABLE", targettable, "PJ", primaryjoin def should_bind(targetcol, othercol): # determine if the given target column is part of the parent table