summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorAnssi Kääriäinen <anssi.kaariainen@thl.fi>2014-11-15 13:04:02 +0200
committerTim Graham <timograham@gmail.com>2014-11-17 18:04:08 +0100
commit4252a14c396bb806a86dfda2d0f6a4f3d96c102a (patch)
treec21cdf7c888f4d08802500723615cd09d16b4750 /django/db/models/sql
parent524e71c9c20da57722b22b978d87690379ca4ade (diff)
Moved bilateral transform fetching to models.lookups
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/query.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index a17cd62f29..ce932ddffb 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1077,7 +1077,6 @@ class Query(object):
and get_transform().
"""
lookups = lookups[:]
- bilaterals = []
while lookups:
name = lookups[0]
# If there is just one part left, try first get_lookup() so
@@ -1089,21 +1088,19 @@ class Query(object):
# We didn't find a lookup. We are going to interpret
# the name as transform, and do an Exact lookup against
# it.
- lhs = self.try_transform(lhs, name, lookups, bilaterals)
+ lhs = self.try_transform(lhs, name, lookups)
final_lookup = lhs.get_lookup('exact')
- return final_lookup(lhs, rhs, bilaterals)
- lhs = self.try_transform(lhs, name, lookups, bilaterals)
+ return final_lookup(lhs, rhs)
+ lhs = self.try_transform(lhs, name, lookups)
lookups = lookups[1:]
- def try_transform(self, lhs, name, rest_of_lookups, bilaterals):
+ def try_transform(self, lhs, name, rest_of_lookups):
"""
Helper method for build_lookup. Tries to fetch and initialize
a transform for name parameter from lhs.
"""
next = lhs.get_transform(name)
if next:
- if getattr(next, 'bilateral', False):
- bilaterals.append((next, rest_of_lookups))
return next(lhs, rest_of_lookups)
else:
raise FieldError(