On Mar 13, 2014, at 8:09 PM, Marco <[email protected]> wrote:

> Hi,
> this line (in red) seems mis-indented:
> 
>         if not isinstance(column, expression.ColumnElement) and \
>                             hasattr(column, '_select_iterable'):
>             for c in column._select_iterable:
>                 if c is column:
>                     break
>                 _ColumnEntity(query, c, namespace=column)
> 
>             if c is not column:
>                 return


it is actually correct, though not well written.   The "return" should take 
place when the column._select_iterable iterator has been exhausted, and we 
haven't found a match (e.g. "c is column" was never True).   It appears the 
purpose here is to detect a class of clause constructs that return [self] for 
their "_select_iterable", which includes TextClause.

I've updated it to use "else:" so that the intent is clear:

--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -3352,8 +3352,7 @@ class _ColumnEntity(_QueryEntity):
                 if c is column:
                     break
                 _ColumnEntity(query, c, namespace=column)
-
-            if c is not column:
+            else:
                 return
         elif isinstance(column, Bundle):
             _BundleEntity(query, column)



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to