]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Make {include,exclude}_properties membership tests ignore column_prefix
authorJason Kirtland <jek@discorporate.us>
Wed, 1 Aug 2007 15:33:55 +0000 (15:33 +0000)
committerJason Kirtland <jek@discorporate.us>
Wed, 1 Aug 2007 15:33:55 +0000 (15:33 +0000)
lib/sqlalchemy/orm/mapper.py
test/orm/mapper.py

index 3560a1c59ada6849817f46963d7df18a8d9772c4..debce60f29d314b078257a22bee8d053c07c8b1d 100644 (file)
@@ -585,13 +585,13 @@ class Mapper(object):
 
             if prop is None:
                 if (self.include_properties is not None and
-                    column_key not in self.include_properties):
-                    self.__log("not including property %s" % (column_key))
+                    column.key not in self.include_properties):
+                    self.__log("not including property %s" % (column.key))
                     continue
                 
                 if (self.exclude_properties is not None and
-                    column_key in self.exclude_properties):
-                    self.__log("excluding property %s" % (column_key))
+                    column.key in self.exclude_properties):
+                    self.__log("excluding property %s" % (column.key))
                     continue
                 
                 prop = ColumnProperty(column)
index 58f0f8411d08705ac2c28ec47082c372baffb600..f224cfc11b23194508b8e8cae153ae2270a33828 100644 (file)
@@ -272,10 +272,10 @@ class MapperTest(MapperSuperTest):
         v_m = mapper(Vendor, inherits=p_m, polymorphic_identity='vendor',
                      exclude_properties=('boss_id', 'employee_number'))
         h_m = mapper(Hoho, t, include_properties=('id', 'type', 'name'))
-        l_m = mapper(Lala, t, exclude_properties=('vendor_id', 'boss_id'))
+        l_m = mapper(Lala, t, exclude_properties=('vendor_id', 'boss_id'),
+                     column_prefix="p_")
 
-        for m in p_m, e_m, m_m, v_m, h_m, l_m:
-            m.compile()
+        p_m.compile()
         
         def assert_props(cls, want):
             have = set([n for n in dir(cls) if not n.startswith('_')])
@@ -290,7 +290,7 @@ class MapperTest(MapperSuperTest):
                                'id', 'name', 'type'])
         assert_props(Vendor, ['vendor_id', 'id', 'name', 'type'])
         assert_props(Hoho, ['id', 'name', 'type'])
-        assert_props(Lala, ['employee_number', 'id', 'name', 'type'])
+        assert_props(Lala, ['p_employee_number', 'p_id', 'p_name', 'p_type'])
 
     def testrecursiveselectby(self):
         """test that no endless loop occurs when traversing for select_by"""