diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-29 02:12:05 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-29 02:12:05 +0000 |
| commit | 944f12bad027d01230b07d0d447d325d747f3897 (patch) | |
| tree | 8711869902ee36049a6114eaea26bd9e1ff68b75 /lib/sqlalchemy/orm/mapper.py | |
| parent | d231088323ffdac36ba4c8a157089c919a41b80d (diff) | |
| download | sqlalchemy-944f12bad027d01230b07d0d447d325d747f3897.tar.gz | |
added assertion to check that mappers only inherit from a mapper with the same "primary/non-primary" setting
Diffstat (limited to 'lib/sqlalchemy/orm/mapper.py')
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index bd5f4c7ec..4fcc7d14c 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -315,6 +315,9 @@ class Mapper(object): self.inherits = self.inherits._do_compile() 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__)) + if self._is_primary_mapper() != self.inherits._is_primary_mapper(): + np = self._is_primary_mapper() and "primary" or "non-primary" + raise exceptions.ArgumentError("Inheritance of %s mapper for class '%s' is only allowed from a %s mapper" % (np, self.class_.__name__, np)) # inherit_condition is optional. if self.local_table is None: self.local_table = self.inherits.local_table |
