diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-05-27 21:43:29 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-05-27 21:43:29 -0400 |
commit | ff399ac75074916045410cedae72489cb60e8b50 (patch) | |
tree | ea3553d73052aaba1abcb86cb0b072ea4fffbc00 /lib/sqlalchemy/sql/compiler.py | |
parent | 0adcfea0d30376461c75cced87481f04a42481c0 (diff) | |
download | sqlalchemy-ff399ac75074916045410cedae72489cb60e8b50.tar.gz |
magic accessors to the rescue
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 5fbfa34f3..5dd7ec564 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -536,14 +536,14 @@ class SQLCompiler(engine.Compiled): # note that its OK we aren't expanding tables and other selectables # here; we can only add a label in the ORDER BY for an individual # label expression in the columns clause. - raw_col = set(order_by_select._raw_columns) + + raw_col = set(l._order_by_label_element.name + for l in order_by_select._raw_columns + if l._order_by_label_element is not None) def label_ok(c): - if c in raw_col: - return c - elif getattr(c, 'modifier', None) in \ - (operators.desc_op, operators.asc_op) and \ - c.element.proxy_set.intersection(raw_col): - return c.element + if c._order_by_label_element is not None and \ + c._order_by_label_element.name in raw_col: + return c._order_by_label_element else: return None |