Commit 2c361c13 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Allow compare an enum item with None.


git-svn-id: https://svn.erp5.org/repos/neo/trunk@1340 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8f08613c
...@@ -116,6 +116,8 @@ class Enum(dict): ...@@ -116,6 +116,8 @@ class Enum(dict):
return "<EnumItem %s (%d)>" % (self._name, self) return "<EnumItem %s (%d)>" % (self._name, self)
def __eq__(self, other): def __eq__(self, other):
if other is None:
return False
assert isinstance(other, (Enum.Item, int, float, long)) assert isinstance(other, (Enum.Item, int, float, long))
assert self._enum == other._enum assert self._enum == other._enum
return int(self) == int(other) return int(self) == int(other)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment