diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-07-01 20:51:33 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-07-01 20:51:33 +0300 |
| commit | 9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d (patch) | |
| tree | d58c7d511c97aa553a0b9416bc6afe06268dc8d9 | |
| parent | 1819f137e974f75cf746a672efd6942091f1179a (diff) | |
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
| -rw-r--r-- | addons/document/nodes.py | 16 |
1 files 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 |
