]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fix for multi-level polymorphic mappers
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 27 Jan 2007 21:30:35 +0000 (21:30 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 27 Jan 2007 21:30:35 +0000 (21:30 +0000)
CHANGES
lib/sqlalchemy/orm/mapper.py

diff --git a/CHANGES b/CHANGES
index 6fdd40713646931facf34cee6d7fb0677de03ddc..140139987ae188800ee04f68271033b6c4e162a1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@
   will match up on straight column names (i.e. its a more liberal policy)
   - eager relation to an inheriting mapper wont fail if no rows returned for
   the relationship.
+  - fix for multi-level polymorphic mappers
 - oracle:
   - when returning "rowid" as the ORDER BY column or in use with ROW_NUMBER OVER,
   oracle dialect checks the selectable its being applied to and will switch to 
index 4cdf62227d65c6b1021e921f477ec8d66926e537..e0ee36fac6f675abb7309312a858139f19f0df7b 100644 (file)
@@ -1149,19 +1149,19 @@ class Mapper(object):
         this mapper is the same mapper as 'self' unless the select_table argument was specified for this mapper."""
         return self.__surrogate_mapper or self
         
-    def _instance(self, context, row, result = None):
+    def _instance(self, context, row, result = None, skip_polymorphic=False):
         """pulls an object instance from the given row and appends it to the given result
         list. if the instance already exists in the given identity map, its not added.  in
         either case, executes all the property loaders on the instance to also process extra
         information in the row."""
 
-        if self.polymorphic_on is not None:
+        if not skip_polymorphic and self.polymorphic_on is not None:
             discriminator = row[self.polymorphic_on]
             if discriminator is not None:
                 mapper = self.polymorphic_map[discriminator]
                 if mapper is not self:
                     row = self.translate_row(mapper, row)
-                    return mapper._instance(context, row, result=result)
+                    return mapper._instance(context, row, result=result, skip_polymorphic=True)
         
         # look in main identity map.  if its there, we dont do anything to it,
         # including modifying any of its related items lists, as its already