From 9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Thu, 1 Jul 2010 20:51:33 +0300 Subject: [PATCH] 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 --- addons/document/nodes.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/document/nodes.py b/addons/document/nodes.py index 998ea7706b2..639d0e9b9b8 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -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