diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-04-18 18:24:07 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-04-18 18:24:07 +0000 |
commit | 3ffa0bda31e2e590ff28f1bb1cccccda010b4462 (patch) | |
tree | fe562d72a1c1c6f32fddf47911db85fe2d7a7057 /lib/sqlalchemy/mapping/mapper.py | |
parent | 5b1871de64019c29bd093297e9194d5de7b93487 (diff) | |
download | sqlalchemy-3ffa0bda31e2e590ff28f1bb1cccccda010b4462.tar.gz |
mapper will verify class inheritance scheme; also will not re-init inherited property, as the improved attribute system seems to handle inheritance OK and allows the property to keep its correct initialization on the parent
exceptions import in query
Diffstat (limited to 'lib/sqlalchemy/mapping/mapper.py')
-rw-r--r-- | lib/sqlalchemy/mapping/mapper.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/mapping/mapper.py b/lib/sqlalchemy/mapping/mapper.py index 80b5680a3..302cb1741 100644 --- a/lib/sqlalchemy/mapping/mapper.py +++ b/lib/sqlalchemy/mapping/mapper.py @@ -88,6 +88,8 @@ class Mapper(object): self.table = table if inherits is not None: + if self.class_.__mro__[1] != inherits.class_: + raise ArgumentError("Class '%s' does not inherit from '%s'" % (self.class_.__name__, inherits.class_.__name__)) self.primarytable = inherits.primarytable # inherit_condition is optional. if not table is inherits.noninherited_table: @@ -214,7 +216,7 @@ class Mapper(object): if not self.props.has_key(key): self.props[key] = prop.copy() self.props[key].parent = self - self.props[key].key = None # force re-init + # self.props[key].key = None # force re-init l = [(key, prop) for key, prop in self.props.iteritems()] for key, prop in l: if getattr(prop, 'key', None) is None: |