function moved to cwvreg tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 18 Feb 2009 13:41:07 +0100
branchtls-sprint
changeset 778 847db4c91061
parent 777 39695e98ba35
child 779 8510e14335e1
function moved to cwvreg
common/registerers.py
--- a/common/registerers.py	Wed Feb 18 13:40:34 2009 +0100
+++ b/common/registerers.py	Wed Feb 18 13:41:07 2009 +0100
@@ -12,19 +12,7 @@
 
 from cubicweb.vregistry import registerer, yes_registerer
 from cubicweb.selectors import implements
-
-def _accepts_interfaces(obj):
-    try:
-        return sorted(obj.accepts_interfaces)
-    except AttributeError:
-        try:
-            impl = obj.__select__.search_selector(implements)
-            if impl:
-                return sorted(impl.expected_ifaces)
-        except AttributeError:
-            pass # old-style vobject classes with no accepts_interfaces
-        return ()
-
+from cubicweb.cwvreg import use_interfaces
 
 class priority_registerer(registerer):
     """systematically kick previous registered class and register the
@@ -75,13 +63,13 @@
     def do_it_yourself(self, registered):
         # if object is accepting interface, we have register it now and
         # remove it later if no object is implementing accepted interfaces
-        if _accepts_interfaces(self.vobject):
+        if use_interfaces(self.vobject):
             return self.vobject
         self.remove_equivalents(registered)
         return self.vobject
     
     def equivalent(self, other):
-        if _accepts_interfaces(self.vobject) != _accepts_interfaces(other):
+        if use_interfaces(self.vobject) != use_interfaces(other):
             return False
         try:
             newaccepts = list(other.accepts)