diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2012-10-03 18:21:39 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2012-10-10 01:15:29 +0300 |
| commit | a8b1861fc4d0a48b4879af803bba094eef145017 (patch) | |
| tree | e4e8e971cc5245c1864a7cab642372cd1027116b /django | |
| parent | 7f4dbdc036a4439ed3e4954625fe91596b314a36 (diff) | |
Revert "Fixed #16211 -- Added comparison and negation ops to F() expressions"
This reverts commit 28abf5f0ebc9d380f25dd278d7ef4642c4504545.
Conflicts:
docs/releases/1.5.txt
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/__init__.py | 3 | ||||
| -rw-r--r-- | django/db/models/expressions.py | 37 | ||||
| -rw-r--r-- | django/utils/tree.py | 8 |
3 files changed, 2 insertions, 46 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 4edde04f42..02d2a16a46 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -913,9 +913,6 @@ class BaseDatabaseOperations(object): can vary between backends (e.g., Oracle with %% and &) and between subexpression types (e.g., date expressions) """ - if connector == 'NOT': - assert len(sub_expressions) == 1 - return 'NOT (%s)' % sub_expressions[0] conn = ' %s ' % connector return conn.join(sub_expressions) diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 972440b858..639ef6ee10 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -18,17 +18,6 @@ class ExpressionNode(tree.Node): AND = '&' OR = '|' - # Unary operator (needs special attention in combine_expression) - NOT = 'NOT' - - # Comparison operators - EQ = '=' - GE = '>=' - GT = '>' - LE = '<=' - LT = '<' - NE = '<>' - def __init__(self, children=None, connector=None, negated=False): if children is not None and len(children) > 1 and connector is None: raise TypeError('You have to specify a connector.') @@ -104,32 +93,6 @@ class ExpressionNode(tree.Node): def __ror__(self, other): return self._combine(other, self.OR, True) - def __invert__(self): - obj = ExpressionNode([self], connector=self.NOT, negated=True) - return obj - - def __eq__(self, other): - return self._combine(other, self.EQ, False) - - def __ge__(self, other): - return self._combine(other, self.GE, False) - - def __gt__(self, other): - return self._combine(other, self.GT, False) - - def __le__(self, other): - return self._combine(other, self.LE, False) - - def __lt__(self, other): - return self._combine(other, self.LT, False) - - def __ne__(self, other): - return self._combine(other, self.NE, False) - - def __bool__(self): - raise TypeError('Boolean operators should be avoided. Use bitwise operators.') - __nonzero__ = __bool__ - def prepare_database_save(self, unused): return self diff --git a/django/utils/tree.py b/django/utils/tree.py index 6229493544..717181d2b9 100644 --- a/django/utils/tree.py +++ b/django/utils/tree.py @@ -88,12 +88,8 @@ class Node(object): Otherwise, the whole tree is pushed down one level and a new root connector is created, connecting the existing tree and the new node. """ - # Using for loop with 'is' instead of 'if node in children' so node - # __eq__ method doesn't get called. The __eq__ method can be overriden - # by subtypes, for example the F-expression. - for child in self.children: - if node is child and conn_type == self.connector: - return + if node in self.children and conn_type == self.connector: + return if len(self.children) < 2: self.connector = conn_type if self.connector == conn_type: |
