171 self._extid_cache = {} |
171 self._extid_cache = {} |
172 # open some connections pools |
172 # open some connections pools |
173 if config.open_connections_pools: |
173 if config.open_connections_pools: |
174 self.open_connections_pools() |
174 self.open_connections_pools() |
175 |
175 |
|
176 def _boostrap_hook_registry(self): |
|
177 """called during bootstrap since we need the metadata hooks""" |
|
178 hooksdirectory = join(CW_SOFTWARE_ROOT, 'hooks') |
|
179 self.vreg.init_registration([hooksdirectory]) |
|
180 self.vreg.load_file(join(hooksdirectory, 'metadata.py'), |
|
181 'cubicweb.hooks.metadata') |
|
182 |
176 def open_connections_pools(self): |
183 def open_connections_pools(self): |
177 config = self.config |
184 config = self.config |
178 self._available_pools = Queue.Queue() |
185 self._available_pools = Queue.Queue() |
179 self._available_pools.put_nowait(pool.ConnectionsPool(self.sources)) |
186 self._available_pools.put_nowait(pool.ConnectionsPool(self.sources)) |
180 if config.read_instance_schema: |
187 if config.read_instance_schema: |
189 etdirectory = join(CW_SOFTWARE_ROOT, 'entities') |
196 etdirectory = join(CW_SOFTWARE_ROOT, 'entities') |
190 self.vreg.init_registration([etdirectory]) |
197 self.vreg.init_registration([etdirectory]) |
191 for modname in ('__init__', 'authobjs', 'wfobjs'): |
198 for modname in ('__init__', 'authobjs', 'wfobjs'): |
192 self.vreg.load_file(join(etdirectory, '%s.py' % modname), |
199 self.vreg.load_file(join(etdirectory, '%s.py' % modname), |
193 'cubicweb.entities.%s' % modname) |
200 'cubicweb.entities.%s' % modname) |
194 hooksdirectory = join(CW_SOFTWARE_ROOT, 'hooks') |
201 self._boostrap_hook_registry() |
195 self.vreg.init_registration([hooksdirectory]) |
|
196 self.vreg.load_file(join(hooksdirectory, 'metadata.py'), |
|
197 'cubicweb.hooks.metadata') |
|
198 else: |
202 else: |
199 # test start: use the file system schema (quicker) |
203 # test start: use the file system schema (quicker) |
200 self.warning("set fs instance'schema") |
204 self.warning("set fs instance'schema") |
201 config.bootstrap_cubes() |
205 config.bootstrap_cubes() |
202 self.set_schema(config.load_schema()) |
206 self.set_schema(config.load_schema()) |
|
207 # make sure we have a hook registry in tests |
|
208 self.vreg['hooks'] = hook.HooksRegistry(self.vreg) |
203 if not config.creating: |
209 if not config.creating: |
204 if 'CWProperty' in self.schema: |
210 if 'CWProperty' in self.schema: |
205 self.vreg.init_properties(self.properties()) |
211 self.vreg.init_properties(self.properties()) |
206 # call source's init method to complete their initialisation if |
212 # call source's init method to complete their initialisation if |
207 # needed (for instance looking for persistent configuration using an |
213 # needed (for instance looking for persistent configuration using an |