summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/mapping
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-04-18 18:24:07 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-04-18 18:24:07 +0000
commit3ffa0bda31e2e590ff28f1bb1cccccda010b4462 (patch)
treefe562d72a1c1c6f32fddf47911db85fe2d7a7057 /lib/sqlalchemy/mapping
parent5b1871de64019c29bd093297e9194d5de7b93487 (diff)
downloadsqlalchemy-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')
-rw-r--r--lib/sqlalchemy/mapping/mapper.py4
-rw-r--r--lib/sqlalchemy/mapping/query.py1
2 files changed, 4 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:
diff --git a/lib/sqlalchemy/mapping/query.py b/lib/sqlalchemy/mapping/query.py
index 72037a347..8233fba65 100644
--- a/lib/sqlalchemy/mapping/query.py
+++ b/lib/sqlalchemy/mapping/query.py
@@ -9,6 +9,7 @@ import objectstore
import sqlalchemy.sql as sql
import sqlalchemy.util as util
import mapper
+from sqlalchemy.exceptions import *
class Query(object):
"""encapsulates the object-fetching operations provided by Mappers."""