cwvreg.py
branchtls-sprint
changeset 776 29ba95ea7e7d
parent 717 54b873918b48
child 777 39695e98ba35
--- a/cwvreg.py	Wed Feb 18 11:50:15 2009 +0100
+++ b/cwvreg.py	Wed Feb 18 13:40:05 2009 +0100
@@ -18,11 +18,25 @@
 
 _ = unicode
 
-class DummyCursorError(Exception): pass
-class RaiseCursor:
-    @classmethod
-    def execute(cls, rql, args=None, eid_key=None):
-        raise DummyCursorError()
+def use_interfaces(obj):
+    from cubicweb.selectors import implements
+    try:
+        # XXX deprecated
+        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 ()
+
+def expand_parent_classes(iface):
+    res = [iface]
+    for parent in iface.__bases__:
+        res += expand_parent_classes(parent)
+    return res
 
 
 class CubicWebRegistry(VRegistry):