]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- clear_mappers() just blows away all of ArgSingleton for now
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Feb 2007 21:38:16 +0000 (21:38 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Feb 2007 21:38:16 +0000 (21:38 +0000)
- 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

lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/strategies.py

index a933cb1b27c4349f12687a0429bdaf30cb8ae01e..3fab0e63e5f0d2cf43327b6eba6c19066cf69f67 100644 (file)
@@ -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.  
index 1cdf0b177ec73e1b35c13d557b5b8ef07bc51895..19868ba132f198a5ddfce391685359e2a3ced607 100644 (file)
@@ -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