summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-11-09 16:36:46 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-11-09 16:36:46 +0000
commit476d395f5e4e5ec37e0fb72cb5d0cd0b0e429a80 (patch)
treee07117f4fbc2751397627752ff74a30e2efdf6a5 /lib
parent9d21a7f080292f69e3065d294ba9fad13a6d81fc (diff)
downloadsqlalchemy-476d395f5e4e5ec37e0fb72cb5d0cd0b0e429a80.tar.gz
- fixed error where Query.add_column() would not accept a class-bound
attribute as an argument; Query also raises an error if an invalid argument was sent to add_column() (at instances() time) [ticket:858]
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/query.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 753e735d1..300d4a549 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -240,6 +240,10 @@ class Query(object):
q = self._clone()
+ # duck type to get a ClauseElement
+ if hasattr(column, 'clause_element'):
+ column = column.clause_element()
+
# alias non-labeled column elements.
if isinstance(column, sql.ColumnElement) and not hasattr(column, '_label'):
column = column.label(None)
@@ -682,6 +686,9 @@ class Query(object):
res.append(row_adapter(row)[m])
process.append((proc, res))
y(m)
+ else:
+ raise exceptions.InvalidRequestError("Invalid column expression '%r'" % m)
+
result = []
else:
result = util.UniqueAppender([])