NotImplemented is not an exception

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset5962c4836b80
branchdefault
phasepublic
hiddenno
parent revision#22e82a22addf add a relation mapping an element to its direct parent (occurence)
child revision#3d33dba1029a Keeps documentation defined in the XML Schema, #705c8cdae9e2 add README
files modified by this revision
pyxst/xml_struct/graph_nodes.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1460732102 -7200
# Fri Apr 15 16:55:02 2016 +0200
# Node ID 5962c4836b80bd4f2150fbaedeaceda9ac6b3896
# Parent 22e82a22addf6869e31975466f19c48ff322e5d9
NotImplemented is not an exception

diff --git a/pyxst/xml_struct/graph_nodes.py b/pyxst/xml_struct/graph_nodes.py
@@ -258,11 +258,11 @@
1      def simplify(self):
2          return self.target.simplify(self.minimum, self.maximum)
3 
4      def __eq__(self, other):
5          if not isinstance(other, Occurence):
6 -            raise NotImplemented
7 +            return NotImplemented
8          if isinstance(self.target, XMLElement):
9              if not isinstance(other.target, XMLElement):
10                  return False
11              return (self.target.qname == other.target.qname
12                      and self.minimum == other.minimum
@@ -874,11 +874,11 @@
13                                  % self.qname)
14              self.parent_elts.append(parent)
15 
16      def __eq__(self, other):
17          if not isinstance(other, XMLAttribute):
18 -            raise NotImplemented
19 +            return NotImplemented
20          return (
21              self.namespace == other.namespace
22              and self.textual_content_type == other.textual_content_type
23              and self.textual_content_is_list == other.textual_content_is_list
24              and self.textual_content_values == other.textual_content_values)