equal
deleted
inserted
replaced
16 from cubicweb import Binary, UnknownProperty |
16 from cubicweb import Binary, UnknownProperty |
17 from cubicweb.vregistry import VRegistry, ObjectNotFound, NoSelectableObject |
17 from cubicweb.vregistry import VRegistry, ObjectNotFound, NoSelectableObject |
18 |
18 |
19 _ = unicode |
19 _ = unicode |
20 |
20 |
21 class DummyCursorError(Exception): pass |
21 def use_interfaces(obj): |
22 class RaiseCursor: |
22 from cubicweb.selectors import implements |
23 @classmethod |
23 try: |
24 def execute(cls, rql, args=None, eid_key=None): |
24 # XXX deprecated |
25 raise DummyCursorError() |
25 return sorted(obj.accepts_interfaces) |
|
26 except AttributeError: |
|
27 try: |
|
28 impl = obj.__select__.search_selector(implements) |
|
29 if impl: |
|
30 return sorted(impl.expected_ifaces) |
|
31 except AttributeError: |
|
32 pass # old-style vobject classes with no accepts_interfaces |
|
33 return () |
|
34 |
|
35 def expand_parent_classes(iface): |
|
36 res = [iface] |
|
37 for parent in iface.__bases__: |
|
38 res += expand_parent_classes(parent) |
|
39 return res |
26 |
40 |
27 |
41 |
28 class CubicWebRegistry(VRegistry): |
42 class CubicWebRegistry(VRegistry): |
29 """extend the generic VRegistry with some cubicweb specific stuff""" |
43 """extend the generic VRegistry with some cubicweb specific stuff""" |
30 |
44 |