1 # -*- coding: utf-8 -*-
4 ## This file is part of Indico
5 ## Copyright (C) 2002 - 2012 European Organization for Nuclear Research (CERN)
7 ## Indico is free software: you can redistribute it and/or
8 ## modify it under the terms of the GNU General Public License as
9 ## published by the Free Software Foundation, either version 3 of the
10 ## License, or (at your option) any later version.
12 ## Indico is distributed in the hope that it will be useful, but
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with Indico. If not, see <http://www.gnu.org/licenses/>.
21 from MaKaC
.common
import HelperMaKaCInfo
22 from MaKaC
.conference
import CategoryManager
, DefaultConference
23 from MaKaC
.user
import Avatar
, AvatarHolder
, LoginInfo
24 from MaKaC
.authentication
import AuthenticatorMgr
27 def initialize_new_db(root
):
29 Initializes a new DB in debug mode
37 cm
= CategoryManager()
40 home
= cm
.getById('0')
43 minfo
= HelperMaKaCInfo
.getMaKaCInfoInstance()
44 minfo
.setDebugActive(True)
49 def create_dummy_user():
51 Creates a dummy user for testing purposes
55 avatar
.setName("fake")
56 avatar
.setSurName("fake")
57 avatar
.setOrganisation("fake")
58 avatar
.setLang("en_GB")
59 avatar
.setEmail("fake@fake.fake")
65 # setting up the login info
66 li
= LoginInfo("dummyuser", "dummyuser")
67 ih
= AuthenticatorMgr()
68 userid
= ih
.createIdentity(li
, avatar
, "Local")
71 # activate the account
72 avatar
.activateAccount()
74 # since the DB is empty, we have to add dummy user as admin
75 minfo
= HelperMaKaCInfo
.getMaKaCInfoInstance()
77 al
= minfo
.getAdminList()
80 dc
= DefaultConference()
81 HelperMaKaCInfo
.getMaKaCInfoInstance().setDefaultConference(dc
)