Django

Code

Changeset 7288

Show
Ignore:
Timestamp:
03/18/08 08:53:22 (6 months ago)
Author:
mtredinnick
Message:

queryset-refactor: Allow exclusions when bumping the aliases on a subquery.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/queryset-refactor/django/db/models/sql/query.py

    r7287 r7288  
    653653                self.alias_map[alias] = tuple(data) 
    654654 
    655     def bump_prefix(self): 
     655    def bump_prefix(self, exceptions=()): 
    656656        """ 
    657657        Changes the alias prefix to the next letter in the alphabet and 
     
    662662        Subclasses who create their own prefix should override this method to 
    663663        produce a similar result (a new prefix and relabelled aliases). 
     664 
     665        The 'exceptions' parameter is a container that holds alias names which 
     666        should not be changed. 
    664667        """ 
    665668        assert ord(self.alias_prefix) < ord('Z') 
     
    668671        prefix = self.alias_prefix 
    669672        for pos, alias in enumerate(self.tables): 
     673            if alias in exceptions: 
     674                continue 
    670675            new_alias = '%s%d' % (prefix, pos) 
    671676            change_map[alias] = new_alias