Switch a datastructure internal to the ORM to be a set, instead of a dictionary.

This commit is contained in:
Alex Gaynor 2012-04-29 22:18:30 -04:00
parent 6ff118cdb9
commit d5a277ba4d
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance
ALL_TERMS = dict([(x, None) for x in (
ALL_TERMS = set([
'bbcontains', 'bboverlaps', 'contained', 'contains',
'contains_properly', 'coveredby', 'covers', 'crosses', 'disjoint',
'distance_gt', 'distance_gte', 'distance_lt', 'distance_lte',
@ -18,7 +18,7 @@ ALL_TERMS = dict([(x, None) for x in (
'left', 'right', 'overlaps_left', 'overlaps_right',
'overlaps_above', 'overlaps_below',
'strictly_above', 'strictly_below'
)])
])
ALL_TERMS.update(sql.constants.QUERY_TERMS)
class GeoQuery(sql.Query):

View File

@ -2,11 +2,11 @@ from collections import namedtuple
import re
# Valid query types (a dictionary is used for speedy lookups).
QUERY_TERMS = dict([(x, None) for x in (
QUERY_TERMS = set([
'exact', 'iexact', 'contains', 'icontains', 'gt', 'gte', 'lt', 'lte', 'in',
'startswith', 'istartswith', 'endswith', 'iendswith', 'range', 'year',
'month', 'day', 'week_day', 'isnull', 'search', 'regex', 'iregex',
)])
])
# Size of each "chunk" for get_iterator calls.
# Larger values are slightly faster at the expense of more storage space.