コード例 #1
0
ファイル: __init__.py プロジェクト: nyimbi/GlobaLeaks
    def epilogue(self):
        # Finalize loading the new whitleblower identity field
        load_default_fields(self.store_new)

        # Apply fixes to the counters
        self.entries_count['Field'] += 21
        self.entries_count['FieldAttr'] += 57
        self.entries_count['FieldOption'] += 2
        self.entries_count['FieldField'] += 20
コード例 #2
0
def init_db(store):
    if GLSettings.db_type == 'sqlite':
        db_create_tables(store)
        appdata_dict = db_init_appdata(store)

        log.debug("Performing database initialization...")

        node = models.Node()
        node.wizard_done = GLSettings.skip_wizard
        node.receipt_salt = generateRandomSalt()

        for k in appdata_dict['node']:
            setattr(node, k, appdata_dict['node'][k])

        notification = models.Notification()
        for k in appdata_dict['templates']:
            setattr(notification, k, appdata_dict['templates'][k])

        store.add(node)
        store.add(notification)

        load_default_questionnaires(store)
        load_default_fields(store)

        admin_dict = {
            'username': u'admin',
            'password': u'globaleaks',
            'deeletable': False,
            'role': u'admin',
            'state': u'enabled',
            'deletable': False,
            'name': u'Admin',
            'description': u'',
            'mail_address': u'',
            'language': node.default_language,
            'timezone': node.default_timezone,
            'password_change_needed': False,
            'pgp_key_remove': False,
            'pgp_key_status': 'disabled',
            'pgp_key_info': '',
            'pgp_key_fingerprint': '',
            'pgp_key_public': '',
            'pgp_key_expiration': datetime_null()
        }

        admin = db_create_admin(store, admin_dict, node.default_language)
        admin.password_change_needed = False
コード例 #3
0
def init_db(store):
    if GLSettings.db_type == 'sqlite':
        db_create_tables(store)
        appdata_dict = db_init_appdata(store)

        log.debug("Performing database initialization...")

        node = models.Node()
        node.wizard_done = GLSettings.skip_wizard
        node.receipt_salt = generateRandomSalt()

        for k in appdata_dict['node']:
            setattr(node, k, appdata_dict['node'][k])

        notification = models.Notification()
        for k in appdata_dict['templates']:
            setattr(notification, k, appdata_dict['templates'][k])

        store.add(node)
        store.add(notification)

        load_default_questionnaires(store)
        load_default_fields(store)

        admin_dict = {
            'username': u'admin',
            'password': u'globaleaks',
            'deeletable': False,
            'role': u'admin',
            'state': u'enabled',
            'deletable': False,
            'name': u'Admin',
            'description': u'',
            'mail_address': u'',
            'language': node.default_language,
            'timezone': node.default_timezone,
            'password_change_needed': False,
            'pgp_key_remove': False,
            'pgp_key_status': 'disabled',
            'pgp_key_info': '',
            'pgp_key_fingerprint': '',
            'pgp_key_public': '',
            'pgp_key_expiration': datetime_null()
        }

        admin = db_create_admin(store, admin_dict, node.default_language)
        admin.password_change_needed = False