summaryrefslogtreecommitdiff
path: root/django/db/models/sql/where.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-07-08 10:39:54 +1000
committerAlex Gaynor <alex.gaynor@gmail.com>2013-07-08 10:39:54 +1000
commit03d9566e0df45c72bffa99fe244a92f0279da56f (patch)
treeb4c9cc9260769d7f79f62c0fe16a2c5a5746e6ed /django/db/models/sql/where.py
parent0b69a755029f8a8ba6005b9d77be8132a7bc0fb3 (diff)
A large number of stylistic cleanups across django/db/
Diffstat (limited to 'django/db/models/sql/where.py')
-rw-r--r--django/db/models/sql/where.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index 2a342d417a..024b995c99 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -16,10 +16,12 @@ from django.utils.six.moves import xrange
from django.utils import timezone
from django.utils import tree
+
# Connection types
AND = 'AND'
OR = 'OR'
+
class EmptyShortCircuit(Exception):
"""
Internal exception used to indicate that a "matches nothing" node should be
@@ -27,6 +29,7 @@ class EmptyShortCircuit(Exception):
"""
pass
+
class WhereNode(tree.Node):
"""
Used to represent the SQL where-clause.
@@ -175,7 +178,7 @@ class WhereNode(tree.Node):
"""
lvalue, lookup_type, value_annotation, params_or_value = child
field_internal_type = lvalue.field.get_internal_type() if lvalue.field else None
-
+
if isinstance(lvalue, Constraint):
try:
lvalue, params = lvalue.process(lookup_type, params_or_value, connection)
@@ -304,14 +307,15 @@ class WhereNode(tree.Node):
clone.children.append(child)
return clone
-class EmptyWhere(WhereNode):
+class EmptyWhere(WhereNode):
def add(self, data, connector):
return
def as_sql(self, qn=None, connection=None):
raise EmptyResultSet
+
class EverythingNode(object):
"""
A node that matches everything.
@@ -385,6 +389,7 @@ class Constraint(object):
new.alias, new.col, new.field = change_map[self.alias], self.col, self.field
return new
+
class SubqueryConstraint(object):
def __init__(self, alias, columns, targets, query_object):
self.alias = alias