diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-06-19 13:25:37 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-06-19 13:25:37 -0400 |
commit | 6de7db07cecd7f6f86452cdc64270c83b5bef212 (patch) | |
tree | 3f6ee04273d12b54a6515eca9820589be13a2c13 /lib/sqlalchemy/ext/declarative.py | |
parent | 17073a015546f9fe0ce09e668e9e318269c09a2a (diff) | |
download | sqlalchemy-6de7db07cecd7f6f86452cdc64270c83b5bef212.tar.gz |
- a mixin class can now define a column that matches
one which is present on a __table__ defined on a
subclass. It cannot, however, define one that is
not present in the __table__, and the error message
here now works. [ticket:1821]
Diffstat (limited to 'lib/sqlalchemy/ext/declarative.py')
-rwxr-xr-x | lib/sqlalchemy/ext/declarative.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index 8a28bb07c..385e0a309 100755 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -645,7 +645,7 @@ def _as_declarative(cls, classname, dict_): mapper_args ={} table_args = inherited_table_args = None tablename = None - parent_columns = None + parent_columns = () for base in cls.__mro__: if _is_mapped_class(base): @@ -670,7 +670,9 @@ def _as_declarative(cls, classname, dict_): "Columns with foreign keys to other columns " "are not allowed on declarative mixins at this time." ) - if name not in dict_: + if name not in dict_ and not ( + '__table__' in dict_ and name in dict_['__table__'].c + ): potential_columns[name]=column_copies[obj]=obj.copy() elif isinstance(obj, RelationshipProperty): raise exceptions.InvalidRequestError( |