<commit_before># -*- coding: UTF-8
#
# wizard

from globaleaks import models, security
from globaleaks.orm import transact
from globaleaks.handlers.base import BaseHandler
from globaleaks.handlers.admin.context import db_create_context
from globaleaks.handlers.admin.receiver import db_create_receiver
from globaleaks.handlers.admin.user import db_create_admin_user
from globaleaks.handlers.public import serialize_node
from globaleaks.rest import requests
from globaleaks.rest.apicache import GLApiCache
from globaleaks.settings import GLSettings
from globaleaks.utils.utility import log, datetime_null

from twisted.internet.defer import inlineCallbacks


@transact
def wizard(store, request, language):
    try:
        node = store.find(models.Node).one()
        node.default_language = language
        node.languages_enabled = [language]
        node.header_title_homepage[language] = request['node']['name']
        node.presentation[language] = request['node']['name']
        node.wizard_done = True

        context = db_create_context(store, request['context'], language)

        request['receiver']['contexts'] = [context.id]
        request['receiver']['language'] = language
        db_create_receiver(store, request['receiver'], language)

        admin_dict = {
            'username': u'admin',
            'password': request['admin']['password'],
            'role': u'admin',
            'state': u'enabled',
            'deletable': False,
            'name': u'Admin',
            'description': u'',
            'mail_address': request['admin']['mail_address'],
            'language': 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()<commit_msg>Fix small regression on wizard configuration introduced in a264966194b0ce1c967eb8e92cb01dc2aa837395<commit_after># -*- coding: UTF-8
#
# wizard

from globaleaks import models, security
from globaleaks.orm import transact
from globaleaks.handlers.base import BaseHandler
from globaleaks.handlers.admin.context import db_create_context
from globaleaks.handlers.admin.receiver import db_create_receiver
from globaleaks.handlers.admin.user import db_create_admin_user
from globaleaks.handlers.public import serialize_node
from globaleaks.rest import requests
from globaleaks.rest.apicache import GLApiCache
from globaleaks.settings import GLSettings
from globaleaks.utils.utility import log, datetime_null

from twisted.internet.defer import inlineCallbacks


@transact
def wizard(store, request, language):
    try:
        node = store.find(models.Node).one()
        node.default_language = language
        node.languages_enabled = [language]
        node.name = request['node']['name']
        node.description[language] = request['node']['name']
        node.header_title_homepage[language] = request['node']['name']
        node.presentation[language] = request['node']['name']
        node.wizard_done = True

        context = db_create_context(store, request['context'], language)

        request['receiver']['contexts'] = [context.id]
        request['receiver']['language'] = language
        db_create_receiver(store, request['receiver'], language)

        admin_dict = {
            'username': u'admin',
            'password': request['admin']['password'],
            'role': u'admin',
            'state': u'enabled',
            'deletable': False,
            'name': u'Admin',
            'description': u'',
            'mail_address': request['admin']['mail_address'],
            'language': 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()
{'fraction_non_alphanumeric': 0.1154127100073046, 'fraction_numerical': 0.006817628439250061, 'mean_word_length': 3.230690010298661, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7303980', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1149, 'n_words': 241}