Django

Code

Changeset 9338

Show
Ignore:
Timestamp:
11/05/08 12:15:48 (2 months ago)
Author:
jbronn
Message:

Fixed resolve_columns so that pagination works again on Oracle GeoQuerySets?; properly set svn:ignore on sitemaps subdir.

Files:

Legend:

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

    r8431 r9338  
    173173        values = [] 
    174174        aliases = self.extra_select.keys() 
    175         index_start = len(aliases) 
     175 
     176        # Have to set a starting row number offset that is used for 
     177        # determining the correct starting row index -- needed for 
     178        # doing pagination with Oracle. 
     179        rn_offset = 0 
     180        if SpatialBackend.oracle: 
     181            if self.high_mark is not None or self.low_mark: rn_offset = 1 
     182        index_start = rn_offset + len(aliases) 
     183 
     184        # Converting any extra selection values (e.g., geometries and 
     185        # distance objects added by GeoQuerySet methods). 
    176186        values = [self.convert_values(v, self.extra_select_fields.get(a, None))  
    177                   for v, a in izip(row[:index_start], aliases)] 
     187                  for v, a in izip(row[rn_offset:index_start], aliases)] 
    178188        if SpatialBackend.oracle: 
    179             # This is what happens normally in Oracle's `resolve_columns`. 
     189            # This is what happens normally in OracleQuery's `resolve_columns`. 
    180190            for value, field in izip(row[index_start:], fields): 
    181191                values.append(self.convert_values(value, field)) 
     
    188198        Using the same routines that Oracle does we can convert our 
    189199        extra selection objects into Geometry and Distance objects. 
    190         TODO: Laziness
     200        TODO: Make converted objects 'lazy' for less overhead
    191201        """ 
    192202        if SpatialBackend.oracle: