Commit 5f0fe1dd authored by Vincent Pelletier's avatar Vincent Pelletier

It is only important to raise a type error when other's type might be equal to...

It is only important to raise a type error when other's type might be equal to EnumItem. In other cases, just return False.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1164 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d5413fbc
......@@ -34,7 +34,10 @@ class EnumItem(int):
Raise if compared type doesn't match.
"""
if not isinstance(other, EnumItem):
raise TypeError, 'Comparing an enum with %r.' % (other, )
if isinstance(other, (int, float, long)):
raise TypeError, 'Comparing an enum with %r.' % (other, )
else:
return False
if other.enum is not self.enum:
raise TypeError, 'Comparing enums of incompatible types: %s ' \
'and %s' % (self, 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