server/repository.py
changeset 9466 c3a5f4507f12
parent 9460 a2a0bc984863
child 9467 ad66d7b3fd48
equal deleted inserted replaced
9465:86d4b41ae339 9466:c3a5f4507f12
    53                       UnknownEid, AuthenticationError, ExecutionError,
    53                       UnknownEid, AuthenticationError, ExecutionError,
    54                       ETypeNotSupportedBySources, MultiSourcesError,
    54                       ETypeNotSupportedBySources, MultiSourcesError,
    55                       BadConnectionId, Unauthorized, ValidationError,
    55                       BadConnectionId, Unauthorized, ValidationError,
    56                       RepositoryError, UniqueTogetherError, onevent)
    56                       RepositoryError, UniqueTogetherError, onevent)
    57 from cubicweb import cwvreg, schema, server
    57 from cubicweb import cwvreg, schema, server
    58 from cubicweb.server import ShuttingDown, utils, hook, pool, querier, sources
    58 from cubicweb.server import ShuttingDown, utils, hook, querier, sources
    59 from cubicweb.server.session import Session, InternalSession, InternalManager
    59 from cubicweb.server.session import Session, InternalSession, InternalManager
    60 from cubicweb.server.ssplanner import EditedEntity
    60 from cubicweb.server.ssplanner import EditedEntity
    61 
    61 
    62 NO_CACHE_RELATIONS = set( [('owned_by', 'object'),
    62 NO_CACHE_RELATIONS = set( [('owned_by', 'object'),
    63                            ('created_by', 'object'),
    63                            ('created_by', 'object'),
   217         """should be called bootstrap_repository, as this is what it does"""
   217         """should be called bootstrap_repository, as this is what it does"""
   218         config = self.config
   218         config = self.config
   219         self._cnxsets_pool = Queue.Queue()
   219         self._cnxsets_pool = Queue.Queue()
   220         # 0. init a cnxset that will be used to fetch bootstrap information from
   220         # 0. init a cnxset that will be used to fetch bootstrap information from
   221         #    the database
   221         #    the database
   222         self._cnxsets_pool.put_nowait(pool.ConnectionsSet(self.system_source))
   222         self._cnxsets_pool.put_nowait(self.system_source.wrapped_connection())
   223         # 1. set used cubes
   223         # 1. set used cubes
   224         if config.creating or not config.read_instance_schema:
   224         if config.creating or not config.read_instance_schema:
   225             config.bootstrap_cubes()
   225             config.bootstrap_cubes()
   226         else:
   226         else:
   227             self.set_schema(self.config.load_bootstrap_schema(), resetvreg=False)
   227             self.set_schema(self.config.load_bootstrap_schema(), resetvreg=False)
   258         # 4. close initialization connection set and reopen fresh ones for
   258         # 4. close initialization connection set and reopen fresh ones for
   259         #    proper initialization
   259         #    proper initialization
   260         self._get_cnxset().close(True)
   260         self._get_cnxset().close(True)
   261         self.cnxsets = [] # list of available cnxsets (can't iterate on a Queue)
   261         self.cnxsets = [] # list of available cnxsets (can't iterate on a Queue)
   262         for i in xrange(config['connections-pool-size']):
   262         for i in xrange(config['connections-pool-size']):
   263             self.cnxsets.append(pool.ConnectionsSet(self.system_source))
   263             self.cnxsets.append(self.system_source.wrapped_connection())
   264             self._cnxsets_pool.put_nowait(self.cnxsets[-1])
   264             self._cnxsets_pool.put_nowait(self.cnxsets[-1])
   265 
   265 
   266     # internals ###############################################################
   266     # internals ###############################################################
   267 
   267 
   268     def init_sources_from_database(self):
   268     def init_sources_from_database(self):