From: Mike Bayer Date: Fri, 11 Aug 2006 19:16:27 +0000 (+0000) Subject: inheritance check uses issubclass() instead of direct __mro__ check X-Git-Tag: rel_0_2_7~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61b7d4fb5af3948a49ad2f1091b3207428a1ee94;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git inheritance check uses issubclass() instead of direct __mro__ check to make sure class A inherits from B, allowing mapper inheritance to more flexibly correspond to class inheritance [ticket:271] --- diff --git a/CHANGES b/CHANGES index d88339419e..de8aa22cef 100644 --- a/CHANGES +++ b/CHANGES @@ -30,6 +30,9 @@ return an array instead of string for SHOW CREATE TABLE call "engine" is deprecated. - fixed ms-sql connect() to work with adodbapi - added "nowait" flag to Select() +- inheritance check uses issubclass() instead of direct __mro__ check +to make sure class A inherits from B, allowing mapper inheritance to more +flexibly correspond to class inheritance [ticket:271] 0.2.6 - big overhaul to schema to allow truly composite primary and foreign diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 4db2b40f21..d4d7479598 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -228,7 +228,7 @@ class Mapper(object): self.inherits = class_mapper(self.inherits, compile=False)._do_compile() else: self.inherits = self.inherits._do_compile() - if self.class_.__mro__[1] != self.inherits.class_: + if not issubclass(self.class_, self.inherits.class_): raise exceptions.ArgumentError("Class '%s' does not inherit from '%s'" % (self.class_.__name__, self.inherits.class_.__name__)) # inherit_condition is optional. if self.local_table is None: