mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-30 12:34:52 -04:00
Make {include,exclude}_properties membership tests ignore column_prefix
This commit is contained in:
@@ -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)
|
||||
|
||||
+4
-4
@@ -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"""
|
||||
|
||||
Reference in New Issue
Block a user