From: Jason Kirtland Date: Thu, 21 Aug 2008 14:24:45 +0000 (+0000) Subject: - Another old-style mixin fix and an explicit mapper() test for it. X-Git-Tag: rel_0_5rc1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d08821ee5ec566132cb813d2e65e20052c1f712a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Another old-style mixin fix and an explicit mapper() test for it. --- diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index d8f32d6253..ff6c7b02ce 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -1044,6 +1044,8 @@ class ClassManager(dict): self.local_attrs = {} self.originals = {} for base in class_.__mro__[-2:0:-1]: # reverse, skipping 1st and last + if not isinstance(base, type): + continue cls_state = manager_of_class(base) if cls_state: self.update(cls_state) diff --git a/test/orm/mapper.py b/test/orm/mapper.py index 57bcba20ce..bcc75e4027 100644 --- a/test/orm/mapper.py +++ b/test/orm/mapper.py @@ -838,13 +838,31 @@ class MapperTest(_fixtures.FixtureTest): def test_unmapped_error(self): mapper(Address, addresses) sa.orm.clear_mappers() - + mapper(User, users, properties={ 'addresses':relation(Address) }) self.assertRaises(sa.orm.exc.UnmappedClassError, sa.orm.compile_mappers) - + + @testing.resolve_artifact_names + def test_oldstyle_mixin(self): + class OldStyle: + pass + class NewStyle(object): + pass + + class A(NewStyle, OldStyle): + pass + + mapper(A, users) + + class B(OldStyle, NewStyle): + pass + + mapper(B, users) + + class OptionsTest(_fixtures.FixtureTest): @testing.fails_on('maxdb')