From 2b7ce4a41ceb53bafde0a3fb61052e15312ccd01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 14 Mar 2011 16:04:14 +0000
Subject: [PATCH] instead of comparing interfaces by name, use
 Interface.implementedBy. The later works properly with interfaces
 inheritance.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44252 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Base.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py
index 1ca325a21f..9464c34f13 100644
--- a/product/ERP5Type/Base.py
+++ b/product/ERP5Type/Base.py
@@ -719,11 +719,12 @@ class Base( CopyContainer,
   security.declarePublic('provides')
   def provides(cls, interface_name):
     """
-    Check if the current class provides a particular interface
+    Check if the current class provides a particular interface from ERP5Type's
+    interfaces registry
     """
-    for interface in implementedBy(cls):
-      if interface.getName() == interface_name:
-        return True
+    interface = getattr(interfaces, interface_name, None)
+    if interface is not None:
+      return interface.implementedBy(cls)
     return False
   provides = classmethod(CachingMethod(provides, 'Base.provides',
                                        cache_factory='erp5_ui_long'))
-- 
2.30.9