]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
cleanup
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 25 Apr 2013 18:13:13 +0000 (14:13 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 25 Apr 2013 18:13:13 +0000 (14:13 -0400)
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/util.py

index 0eed50ea419e87dc656ad43757cfcc12ecbbf35b..6660a39ef0881a9bf6a0fb42e6186cba81e1f6d7 100644 (file)
@@ -1152,7 +1152,6 @@ class JoinedLoader(AbstractRelationshipLoader):
 
         towrap = context.eager_joins.setdefault(entity_key, default_towrap)
 
-        join_to_left = False
         if adapter:
             if getattr(adapter, 'aliased_class', None):
                 onclause = getattr(
@@ -1168,11 +1167,6 @@ class JoinedLoader(AbstractRelationshipLoader):
                                 self.key, self.parent_property
                             )
 
-            if onclause is self.parent_property:
-                # TODO: this is a temporary hack to
-                # account for polymorphic eager loads where
-                # the eagerload is referencing via of_type().
-                join_to_left = True
         else:
             onclause = self.parent_property
 
@@ -1182,7 +1176,6 @@ class JoinedLoader(AbstractRelationshipLoader):
                                             towrap,
                                             clauses.aliased_class,
                                             onclause,
-                                            join_to_left=join_to_left,
                                             isouter=not innerjoin
                                             )
 
index 9472f86980c56234ebbc297e5d3d660dd6df9c6a..a594af259bfc7acc48a19468441832c489c32a94 100644 (file)
@@ -870,20 +870,10 @@ class _ORMJoin(expression.Join):
 
     __visit_name__ = expression.Join.__visit_name__
 
-    def __init__(self, left, right, onclause=None,
-                            isouter=False, join_to_left=True):
+    def __init__(self, left, right, onclause=None, isouter=False):
 
-        adapt_from = None
         left_info = inspection.inspect(left)
-
-        if hasattr(left, '_orm_infos'):
-            left_orm_info = left._orm_infos[1]
-        else:
-            #if isinstance(left, expression.Join):
-            #    info = inspection.inspect(left.right)
-            #else:
-            #    info = inspection.inspect(left)
-            left_orm_info = left_info
+        left_orm_info = getattr(left, '_joined_from_info', left_info)
 
         right_info = inspection.inspect(right)
 
@@ -892,9 +882,7 @@ class _ORMJoin(expression.Join):
         else:
             adapt_to = None
 
-#        import pdb
-#        pdb.set_trace()
-        self._orm_infos = (left_orm_info, right_info)
+        self._joined_from_info = right_info
 
         if isinstance(onclause, basestring):
             onclause = getattr(left_orm_info.entity, onclause)
@@ -909,33 +897,11 @@ class _ORMJoin(expression.Join):
             prop = None
 
         if prop:
-            #import pdb
-            #pdb.set_trace()
             if sql_util.clause_is_present(on_selectable, left_info.selectable):
                 adapt_from = on_selectable
             else:
                 adapt_from = left_info.selectable
-#                import pdb
-#                pdb.set_trace()
-                #adapt_from = left_orm_info.selectable
-                #adapt_from = left_info.selectable
-#                adapt_from = None
-#            if adapt_from is None:
-#                _derived = []
-#                for s in expression._from_objects(left_info.selectable):
-#                    if s == on_selectable:
-#                        adapt_from = s
-#                        break
-#                    elif s.is_derived_from(on_selectable):
-#                        _derived.append(s)
-#                else:
-#                    if _derived:
-#                        adapt_from = _derived[0]
-
-            #if adapt_from is None:
-#            adapt_from = left_info.selectable
-
-            #adapt_from = None
+
             pj, sj, source, dest, \
                 secondary, target_adapter = prop._create_joins(
                             source_selectable=adapt_from,
@@ -953,14 +919,14 @@ class _ORMJoin(expression.Join):
 
         expression.Join.__init__(self, left, right, onclause, isouter)
 
-    def join(self, right, onclause=None, isouter=False, join_to_left=True):
-        return _ORMJoin(self, right, onclause, isouter, join_to_left)
+    def join(self, right, onclause=None, isouter=False, join_to_left=None):
+        return _ORMJoin(self, right, onclause, isouter)
 
-    def outerjoin(self, right, onclause=None, join_to_left=True):
-        return _ORMJoin(self, right, onclause, True, join_to_left)
+    def outerjoin(self, right, onclause=None, join_to_left=None):
+        return _ORMJoin(self, right, onclause, True)
 
 
-def join(left, right, onclause=None, isouter=False, join_to_left=True):
+def join(left, right, onclause=None, isouter=False, join_to_left=None):
     """Produce an inner join between left and right clauses.
 
     :func:`.orm.join` is an extension to the core join interface
@@ -971,11 +937,6 @@ def join(left, right, onclause=None, isouter=False, join_to_left=True):
     be a SQL expression, or an attribute or string name
     referencing a configured :func:`.relationship`.
 
-    ``join_to_left`` indicates to attempt aliasing the ON clause,
-    in whatever form it is passed, to the selectable
-    passed as the left side.  If False, the onclause
-    is used as is.
-
     :func:`.orm.join` is not commonly needed in modern usage,
     as its functionality is encapsulated within that of the
     :meth:`.Query.join` method, which features a
@@ -999,11 +960,14 @@ def join(left, right, onclause=None, isouter=False, join_to_left=True):
     See :meth:`.Query.join` for information on modern usage
     of ORM level joins.
 
+    .. versionchanged:: 0.8.1 - the ``join_to_left`` parameter
+       is no longer used, and is deprecated.
+
     """
-    return _ORMJoin(left, right, onclause, isouter, join_to_left)
+    return _ORMJoin(left, right, onclause, isouter)
 
 
-def outerjoin(left, right, onclause=None, join_to_left=True):
+def outerjoin(left, right, onclause=None, join_to_left=None):
     """Produce a left outer join between left and right clauses.
 
     This is the "outer join" version of the :func:`.orm.join` function,
@@ -1011,7 +975,7 @@ def outerjoin(left, right, onclause=None, join_to_left=True):
     See that function's documentation for other usage details.
 
     """
-    return _ORMJoin(left, right, onclause, True, join_to_left)
+    return _ORMJoin(left, right, onclause, True)
 
 
 def with_parent(instance, prop):