From 5f0fe1dd9d38ba820b23dd78d6b920f7bbe127f1 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Tue, 4 Aug 2009 08:54:43 +0000
Subject: [PATCH] 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
---
 neo/protocol.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/neo/protocol.py b/neo/protocol.py
index 3dd31be6..f71a2750 100644
--- a/neo/protocol.py
+++ b/neo/protocol.py
@@ -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)
-- 
2.30.9