equal
deleted
inserted
replaced
18 ObjectNotFound, NoSelectableObject, RegistryNotFound, |
18 ObjectNotFound, NoSelectableObject, RegistryNotFound, |
19 RegistryOutOfDate, CW_EVENT_MANAGER, onevent) |
19 RegistryOutOfDate, CW_EVENT_MANAGER, onevent) |
20 from cubicweb.utils import dump_class |
20 from cubicweb.utils import dump_class |
21 from cubicweb.vregistry import VRegistry, Registry, class_regid |
21 from cubicweb.vregistry import VRegistry, Registry, class_regid |
22 from cubicweb.rtags import RTAGS |
22 from cubicweb.rtags import RTAGS |
23 |
|
24 |
|
25 @onevent('before-registry-reload') |
|
26 def clear_rtag_objects(): |
|
27 for rtag in RTAGS: |
|
28 rtag.clear() |
|
29 |
23 |
30 |
24 |
31 def use_interfaces(obj): |
25 def use_interfaces(obj): |
32 """return interfaces used by the given object by searching for implements |
26 """return interfaces used by the given object by searching for implements |
33 selectors, with a bw compat fallback to accepts_interfaces attribute |
27 selectors, with a bw compat fallback to accepts_interfaces attribute |
263 config.init_log(debug=debug) |
257 config.init_log(debug=debug) |
264 super(CubicWebVRegistry, self).__init__(config) |
258 super(CubicWebVRegistry, self).__init__(config) |
265 self.schema = None |
259 self.schema = None |
266 self.initialized = False |
260 self.initialized = False |
267 self.reset() |
261 self.reset() |
|
262 if self.config.mode != 'test': |
|
263 # don't clear rtags during test, this may cause breakage with |
|
264 # manually imported appobject modules |
|
265 @onevent('before-registry-reload') |
|
266 def clear_rtag_objects(): |
|
267 for rtag in RTAGS: |
|
268 rtag.clear() |
268 |
269 |
269 def setdefault(self, regid): |
270 def setdefault(self, regid): |
270 try: |
271 try: |
271 return self[regid] |
272 return self[regid] |
272 except RegistryNotFound: |
273 except RegistryNotFound: |