--- a/schema.py Tue Sep 08 17:15:03 2015 +0200
+++ b/schema.py Tue Sep 08 18:04:57 2015 +0200
@@ -253,6 +253,9 @@
return self.expression == other.expression
return False
+ def __ne__(self, other):
+ return not (self == other)
+
def __hash__(self):
return hash(self.expression)
--- a/server/edition.py Tue Sep 08 17:15:03 2015 +0200
+++ b/server/edition.py Tue Sep 08 18:04:57 2015 +0200
@@ -38,7 +38,7 @@
class EditedEntity(dict):
"""encapsulate entities attributes being written by an RQL query"""
def __init__(self, entity, **kwargs):
- dict.__init__(self, **kwargs)
+ super(EditedEntity, self).__init__(**kwargs)
self.entity = entity
self.skip_security = set()
self.querier_pending_relations = {}
@@ -50,10 +50,13 @@
def __lt__(self, other):
# we don't want comparison by value inherited from dict
- return id(self) < id(other)
+ raise NotImplementedError
def __eq__(self, other):
- return id(self) == id(other)
+ return self is other
+
+ def __ne__(self, other):
+ return not (self == other)
def __setitem__(self, attr, value):
assert attr != 'eid'
--- a/utils.py Tue Sep 08 17:15:03 2015 +0200
+++ b/utils.py Tue Sep 08 18:04:57 2015 +0200
@@ -208,8 +208,10 @@
if isinstance(other, RepeatList):
return other._size == self._size and other._item == self._item
return self[:] == other
- # py3k future warning "Overriding __eq__ blocks inheritance of __hash__ in 3.x"
- # is annoying but won't go away because we don't want to hash() the repeatlist
+ def __ne__(self, other):
+ return not (self == other)
+ def __hash__(self):
+ raise NotImplementedError
def pop(self, i):
self._size -= 1