#NEWLINE# def promote_joins( self , aliases ) : #NEWLINE# #INDENT# "\n        Promotes recursively the join type of given aliases and its children to\n        an outer join. If 'unconditional' is False, the join is only promoted if\n        it is nullable or the parent join is an outer join.\n\n        The children promotion is done to avoid join chains that contain a LOUTER\n        b INNER c. So, if we have currently a INNER b INNER c and a->b is promoted,\n        then we must also promote b->c automatically, or otherwise the promotion\n        of a->b doesn't actually change anything in the query results.\n        " #NEWLINE# aliases = list ( aliases ) #NEWLINE# while aliases : #NEWLINE# #INDENT# alias = aliases . pop ( 0 ) #NEWLINE# if ( self . alias_map [ alias ] . join_type is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# assert ( self . alias_map [ alias ] . join_type is not None ) #NEWLINE# parent_alias = self . alias_map [ alias ] . parent_alias #NEWLINE# parent_louter = ( parent_alias and ( self . alias_map [ parent_alias ] . join_type == LOUTER ) ) #NEWLINE# already_louter = ( self . alias_map [ alias ] . join_type == LOUTER ) #NEWLINE# if ( ( self . alias_map [ alias ] . nullable or parent_louter ) and ( not already_louter ) ) : #NEWLINE# #INDENT# self . alias_map [ alias ] = self . alias_map [ alias ] . promote ( ) #NEWLINE# aliases . extend ( ( join for join in self . alias_map . keys ( ) if ( ( self . alias_map [ join ] . parent_alias == alias ) and ( join not in aliases ) ) ) )