]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
oops, change from yesterday fails the zblog tests...now i understand !
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 21 Jan 2007 21:03:37 +0000 (21:03 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 21 Jan 2007 21:03:37 +0000 (21:03 +0000)
lib/sqlalchemy/orm/mapper.py

index dc2965ab37e882d9adade77d8f90cb830c04e6d8..df09402bf73d3bf2b863a7f1608b73c82c89e776 100644 (file)
@@ -691,7 +691,12 @@ class Mapper(object):
             prop.set_parent(self)
             
         if isinstance(prop, ColumnProperty):
-            col = self.select_table.corresponding_column(prop.columns[0], keys_ok=False, raiseerr=True)
+            # relate the mapper's "select table" to the given ColumnProperty
+            col = self.select_table.corresponding_column(prop.columns[0], keys_ok=True, raiseerr=False)
+            # col might not be present! the selectable given to the mapper need not include "deferred"
+            # columns (included in zblog tests)
+            if col is None:
+                col = prop.columns[0]
             self.columns[key] = col
             for col in prop.columns:
                 proplist = self.columntoproperty.setdefault(col, [])