Django

Code

Changeset 3317

Show
Ignore:
Timestamp:
07/10/06 21:32:53 (2 years ago)
Author:
adrian
Message:

Fixed #1614 -- get_sql(), lookup_inner() and parse_lookup() no longer return a 'tables' parameter, because 'tables' was never getting assigned, anywhere.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/models/query.py

    r3300 r3317  
    442442 
    443443        # Convert self._filters into SQL. 
    444         tables2, joins2, where2, params2 = self._filters.get_sql(opts) 
    445         tables.extend(tables2) 
     444        joins2, where2, params2 = self._filters.get_sql(opts) 
    446445        joins.update(joins2) 
    447446        where.extend(where2) 
     
    571570 
    572571    def get_sql(self, opts): 
    573         tables, joins, where, params = [], SortedDict(), [], [] 
     572        joins, where, params = SortedDict(), [], [] 
    574573        for val in self.args: 
    575             tables2, joins2, where2, params2 = val.get_sql(opts) 
    576             tables.extend(tables2) 
     574            joins2, where2, params2 = val.get_sql(opts) 
    577575            joins.update(joins2) 
    578576            where.extend(where2) 
    579577            params.extend(params2) 
    580578        if where: 
    581             return tables, joins, ['(%s)' % self.operator.join(where)], params 
    582         return tables, joins, [], params 
     579            return joins, ['(%s)' % self.operator.join(where)], params 
     580        return joins, [], params 
    583581 
    584582class QAnd(QOperator): 
     
    631629 
    632630    def get_sql(self, opts): 
    633         tables, joins, where, params = self.q.get_sql(opts) 
     631        joins, where, params = self.q.get_sql(opts) 
    634632        where2 = ['(NOT (%s))' % " AND ".join(where)] 
    635         return tables, joins, where2, params 
     633        return joins, where2, params 
    636634 
    637635def get_where_clause(lookup_type, table_prefix, field_name, value): 
     
    707705    # there for others to implement custom Q()s, etc that return other join 
    708706    # types. 
    709     tables, joins, where, params = [], SortedDict(), [], [] 
     707    joins, where, params = SortedDict(), [], [] 
    710708 
    711709    for kwarg, value in kwarg_items: 
     
    734732                raise TypeError, "Cannot parse keyword query %r" % kwarg 
    735733 
    736             tables2, joins2, where2, params2 = lookup_inner(path, clause, value, opts, opts.db_table, None) 
    737             tables.extend(tables2) 
     734            joins2, where2, params2 = lookup_inner(path, clause, value, opts, opts.db_table, None) 
    738735            joins.update(joins2) 
    739736            where.extend(where2) 
    740737            params.extend(params2) 
    741     return tables, joins, where, params 
     738    return joins, where, params 
    742739 
    743740class FieldFound(Exception): 
     
    759756 
    760757def lookup_inner(path, clause, value, opts, table, column): 
    761     tables, joins, where, params = [], SortedDict(), [], [] 
     758    joins, where, params = SortedDict(), [], [] 
    762759    current_opts = opts 
    763760    current_table = table 
     
    879876 
    880877        # There are name queries remaining. Recurse deeper. 
    881         tables2, joins2, where2, params2 = lookup_inner(path, clause, value, new_opts, new_table, join_column) 
    882  
    883         tables.extend(tables2) 
     878        joins2, where2, params2 = lookup_inner(path, clause, value, new_opts, new_table, join_column) 
     879 
    884880        joins.update(joins2) 
    885881        where.extend(where2) 
     
    926922        params.extend(field.get_db_prep_lookup(clause, value)) 
    927923 
    928     return tables, joins, where, params 
     924    return joins, where, params 
    929925 
    930926def delete_objects(seen_objs):