equal
deleted
inserted
replaced
119 def init_repository(config, interactive=True, drop=False, vreg=None): |
119 def init_repository(config, interactive=True, drop=False, vreg=None): |
120 """initialise a repository database by creating tables add filling them |
120 """initialise a repository database by creating tables add filling them |
121 with the minimal set of entities (ie at least the schema, base groups and |
121 with the minimal set of entities (ie at least the schema, base groups and |
122 a initial user) |
122 a initial user) |
123 """ |
123 """ |
124 from cubicweb.dbapi import in_memory_cnx |
124 from cubicweb.dbapi import in_memory_repo_cnx |
125 from cubicweb.server.repository import Repository |
125 from cubicweb.server.repository import Repository |
126 from cubicweb.server.utils import manager_userpasswd |
126 from cubicweb.server.utils import manager_userpasswd |
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 |
183 {'u': admin.eid}) |
183 {'u': admin.eid}) |
184 session.commit() |
184 session.commit() |
185 repo.shutdown() |
185 repo.shutdown() |
186 # reloging using the admin user |
186 # reloging using the admin user |
187 config._cubes = None # avoid assertion error |
187 config._cubes = None # avoid assertion error |
188 repo, cnx = in_memory_cnx(config, login, password=pwd) |
188 repo, cnx = in_memory_repo_cnx(config, login, password=pwd) |
189 repo.system_source.eid = ssource.eid # redo this manually |
189 repo.system_source.eid = ssource.eid # redo this manually |
190 # trigger vreg initialisation of entity classes |
190 # trigger vreg initialisation of entity classes |
191 config.cubicweb_appobject_path = set(('entities',)) |
191 config.cubicweb_appobject_path = set(('entities',)) |
192 config.cube_appobject_path = set(('entities',)) |
192 config.cube_appobject_path = set(('entities',)) |
193 repo.vreg.set_schema(repo.schema) |
193 repo.vreg.set_schema(repo.schema) |