Document API: fix equality operators
They must first check for the type of the 'other' side, or attribute errors may occur. bzr revid: p_christ@hol.gr-20100701175133-mjauo28qv6vkqfuq
This commit is contained in:
@@ -392,10 +392,10 @@ class node_dir(node_database):
|
||||
pass
|
||||
|
||||
def __eq__(self, other):
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
if type(self) != type(other):
|
||||
return False
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
# Two directory nodes, for the same document.directory, may have a
|
||||
# different context! (dynamic folders)
|
||||
if self.dctx != other.dctx:
|
||||
@@ -526,10 +526,10 @@ class node_res_dir(node_class):
|
||||
self.dctx_dict['dctx_' + dfld.field] = dfld.expr
|
||||
|
||||
def __eq__(self, other):
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
if type(self) != type(other):
|
||||
return False
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
# Two nodes, for the same document.directory, may have a
|
||||
# different context! (dynamic folders)
|
||||
if self.dctx != other.dctx:
|
||||
@@ -640,10 +640,10 @@ class node_res_obj(node_class):
|
||||
self.res_id = res_id
|
||||
|
||||
def __eq__(self, other):
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
if type(self) != type(other):
|
||||
return False
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
if not self.res_model == other.res_model:
|
||||
return False
|
||||
if not self.res_id == other.res_id:
|
||||
@@ -852,10 +852,10 @@ class node_file(node_class):
|
||||
par = par.parent_id
|
||||
|
||||
def __eq__(self, other):
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
if type(self) != type(other):
|
||||
return False
|
||||
if not self.context == other.context:
|
||||
return False
|
||||
if self.dctx != other.dctx:
|
||||
return False
|
||||
return self.file_id == other.file_id
|
||||
|
||||
Reference in New Issue
Block a user