209 self.vreg.init_properties(self.properties()) |
209 self.vreg.init_properties(self.properties()) |
210 # call source's init method to complete their initialisation if |
210 # call source's init method to complete their initialisation if |
211 # needed (for instance looking for persistent configuration using an |
211 # needed (for instance looking for persistent configuration using an |
212 # internal session, which is not possible until pools have been |
212 # internal session, which is not possible until pools have been |
213 # initialized) |
213 # initialized) |
214 for source in self.sources: |
214 for source in self.sources_by_uri.itervalues(): |
215 source.init() |
215 source.init(source in self.sources) |
216 else: |
216 else: |
217 # call init_creating so that for instance native source can |
217 # call init_creating so that for instance native source can |
218 # configurate tsearch according to postgres version |
218 # configurate tsearch according to postgres version |
219 for source in self.sources: |
219 for source in self.sources: |
220 source.init_creating() |
220 source.init_creating() |
261 sourceent.host_config) |
261 sourceent.host_config) |
262 source.eid = sourceent.eid |
262 source.eid = sourceent.eid |
263 self.sources_by_eid[sourceent.eid] = source |
263 self.sources_by_eid[sourceent.eid] = source |
264 self.sources_by_uri[sourceent.name] = source |
264 self.sources_by_uri[sourceent.name] = source |
265 if self.config.source_enabled(source): |
265 if self.config.source_enabled(source): |
|
266 source.init(True, session=sourceent._cw) |
266 self.sources.append(source) |
267 self.sources.append(source) |
267 self.querier.set_planner() |
268 self.querier.set_planner() |
268 if add_to_pools: |
269 if add_to_pools: |
269 for pool in self.pools: |
270 for pool in self.pools: |
270 pool.add_source(source) |
271 pool.add_source(source) |
|
272 else: |
|
273 source.init(False, session=sourceent._cw) |
271 self._clear_planning_caches() |
274 self._clear_planning_caches() |
272 |
275 |
273 def remove_source(self, uri): |
276 def remove_source(self, uri): |
274 source = self.sources_by_uri.pop(uri) |
277 source = self.sources_by_uri.pop(uri) |
275 del self.sources_by_eid[source.eid] |
278 del self.sources_by_eid[source.eid] |