summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-26 10:59:39 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-26 10:59:39 -0400
commitcb0c1eda24e1546fcdc9b4e46adc1c5fb14b60d0 (patch)
tree716afe20e3d18c0a4d165fb1306edd6209cdf7c1
parent19ec6c33681ee4d7793b7c6a9301425cd34abb0b (diff)
downloadsqlalchemy-cb0c1eda24e1546fcdc9b4e46adc1c5fb14b60d0.tar.gz
comments
-rw-r--r--lib/sqlalchemy/ext/declarative/base.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py
index 9cf07e208..291608b6c 100644
--- a/lib/sqlalchemy/ext/declarative/base.py
+++ b/lib/sqlalchemy/ext/declarative/base.py
@@ -254,7 +254,6 @@ class _MapperConfig(object):
for k in list(dict_):
- # TODO: improve this ? all dunders ?
if k in ('__table__', '__tablename__', '__mapper_args__'):
continue
@@ -276,12 +275,18 @@ class _MapperConfig(object):
"%s: possibly a copy-and-paste error with a comma "
"left at the end of the line?" % k)
continue
- if not isinstance(value, (Column, MapperProperty)):
+ elif not isinstance(value, (Column, MapperProperty)):
+ # using @declared_attr for some object that
+ # isn't Column/MapperProperty; remove from the dict_
+ # and place the evaulated value onto the class.
if not k.startswith('__'):
dict_.pop(k)
setattr(cls, k, value)
continue
- if k == 'metadata':
+ # we expect to see the name 'metadata' in some valid cases;
+ # however at this point we see it's assigned to something trying
+ # to be mapped, so raise for that.
+ elif k == 'metadata':
raise exc.InvalidRequestError(
"Attribute name 'metadata' is reserved "
"for the MetaData instance when using a "