From: Mike Bayer Date: Sun, 5 Feb 2006 19:16:34 +0000 (+0000) Subject: __init__ monkeypatch looks for __init__ in the class' dict rather than via getattr... X-Git-Tag: rel_0_1_0~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a31a7d0dc082df31101bc93fdd2501d20d39678f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git __init__ monkeypatch looks for __init__ in the class' dict rather than via getattr(), to bypass inheritance lookups --- diff --git a/lib/sqlalchemy/mapping/mapper.py b/lib/sqlalchemy/mapping/mapper.py index 4516ae7b36..eb54e0301d 100644 --- a/lib/sqlalchemy/mapping/mapper.py +++ b/lib/sqlalchemy/mapping/mapper.py @@ -212,7 +212,7 @@ class Mapper(object): """sets up our classes' overridden __init__ method, this mappers hash key as its '_mapper' property, and our columns as its 'c' property. if the class already had a mapper, the old __init__ method is kept the same.""" - if not hasattr(self.class_, '_mapper'): + if not self.class_.__dict__.has_key('_mapper'): oldinit = self.class_.__init__ def init(self, *args, **kwargs): nohist = kwargs.pop('_mapper_nohistory', False)