server/__init__.py
branchstable
changeset 7129 455b503fb7ff
parent 7094 4f9f13a50484
child 7186 287f2273917f
equal deleted inserted replaced
7128:f1fe05d5224e 7129:455b503fb7ff
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
   127     from cubicweb.server.sqlutils import sqlexec, sqlschema, sqldropschema
   127     from cubicweb.server.sqlutils import sqlexec, sqlschema, sqldropschema
   128     # configuration to avoid db schema loading and user'state checking
   128     # configuration to avoid db schema loading and user'state checking
   129     # on connection
   129     # on connection
   130     config.creating = True
   130     config.creating = True
   131     config.consider_user_state = False
   131     config.consider_user_state = False
   132     config.set_language = False
       
   133     # only enable the system source at initialization time
   132     # only enable the system source at initialization time
   134     repo = Repository(config, vreg=vreg)
   133     repo = Repository(config, vreg=vreg)
   135     schema = repo.schema
   134     schema = repo.schema
   136     sourcescfg = config.sources()
   135     sourcescfg = config.sources()
   137     _title = '-> creating tables '
   136     _title = '-> creating tables '
   208     session.close()
   207     session.close()
   209     repo.shutdown()
   208     repo.shutdown()
   210     # restore initial configuration
   209     # restore initial configuration
   211     config.creating = False
   210     config.creating = False
   212     config.consider_user_state = True
   211     config.consider_user_state = True
   213     config.set_language = True
       
   214     print '-> database for instance %s initialized.' % config.appid
   212     print '-> database for instance %s initialized.' % config.appid
   215 
   213 
   216 
   214 
   217 def initialize_schema(config, schema, mhandler, event='create'):
   215 def initialize_schema(config, schema, mhandler, event='create'):
   218     from cubicweb.server.schemaserial import serialize_schema
   216     from cubicweb.server.schemaserial import serialize_schema