[bootstrap] metadata hooks need to be registered at bootstrap time for db creation
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 23 Sep 2009 11:16:38 +0200
changeset 3409 c684606a95e0
parent 3408 c92170fca813
child 3410 47832374cf14
[bootstrap] metadata hooks need to be registered at bootstrap time for db creation
server/repository.py
--- a/server/repository.py	Wed Sep 23 11:13:39 2009 +0200
+++ b/server/repository.py	Wed Sep 23 11:16:38 2009 +0200
@@ -188,12 +188,13 @@
             # need to load the Any and CWUser entity types
             etdirectory = join(CW_SOFTWARE_ROOT, 'entities')
             self.vreg.init_registration([etdirectory])
-            self.vreg.load_file(join(etdirectory, '__init__.py'),
-                                'cubicweb.entities.__init__')
-            self.vreg.load_file(join(etdirectory, 'authobjs.py'),
-                                'cubicweb.entities.authobjs')
-            self.vreg.load_file(join(etdirectory, 'wfobjs.py'),
-                                'cubicweb.entities.wfobjs')
+            for modname in ('__init__', 'authobjs', 'wfobjs'):
+                self.vreg.load_file(join(etdirectory, '%s.py' % modname),
+                                'cubicweb.entities.%s' % modname)
+            hooksdirectory = join(CW_SOFTWARE_ROOT, 'hooks')
+            self.vreg.init_registration([hooksdirectory])
+            self.vreg.load_file(join(hooksdirectory, 'metadata.py'),
+                                'cubicweb.hooks.metadata')
         else:
             # test start: use the file system schema (quicker)
             self.warning("set fs instance'schema")