instrument cwvreg, so we may know what's being loaded by asking the registry store
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 27 Sep 2013 14:15:24 +0200
changeset 9367 c8a5f7f43c03
parent 9366 bcbc92223b35
child 9368 10694dd136f3
instrument cwvreg, so we may know what's being loaded by asking the registry store
cwvreg.py
--- a/cwvreg.py	Tue Jan 07 16:19:18 2014 +0100
+++ b/cwvreg.py	Fri Sep 27 14:15:24 2013 +0200
@@ -615,6 +615,15 @@
         self.register_objects(path)
         CW_EVENT_MANAGER.emit('after-registry-reload')
 
+    def load_file(self, filepath, modname):
+        # override to allow some instrumentation (eg localperms)
+        modpath = modname.split('.')
+        try:
+            self.currently_loading_cube = modpath[modpath.index('cubes') + 1]
+        except ValueError:
+            self.currently_loading_cube = 'cubicweb'
+        return super(CWRegistryStore, self).load_file(filepath, modname)
+
     def _set_schema(self, schema):
         """set instance'schema"""
         self.schema = schema