Exemplo n.º 1
0
def db_serialize_node(store, language):
    """
    Serialize node info.
    """
    # Contexts and Receivers relationship
    configured = store.find(models.ReceiverContext).count() > 0

    ro_node = NodeFactory(store).public_export()

    misc_dict = {
        'languages_enabled': l10n.EnabledLanguage.list(store),
        'languages_supported': LANGUAGES_SUPPORTED,
        'configured': configured,
        'accept_submissions': GLSettings.accept_submissions,
        'logo': db_get_file(store, u'logo'),
        'favicon': db_get_file(store, u'favicon'),
        'css': db_get_file(store, u'css'),
        'homepage': db_get_file(store, u'homepage'),
        'script': db_get_file(store, u'script')
    }

    l10n_dict = NodeL10NFactory(store).localized_dict(language)

    ret = disjoint_union(ro_node, l10n_dict, misc_dict)

    return ret
Exemplo n.º 2
0
def db_serialize_node(store, language):
    """
    Serialize node info.
    """
    # Contexts and Receivers relationship
    configured = store.find(models.ReceiverContext).count() > 0

    ro_node = NodeFactory(store).public_export()

    misc_dict = {
        'languages_enabled': l10n.EnabledLanguage.list(store),
        'languages_supported': LANGUAGES_SUPPORTED,
        'configured': configured,
        'accept_submissions': GLSettings.accept_submissions,
        'logo': db_get_file(store, u'logo'),
        'favicon': db_get_file(store, u'favicon'),
        'css': db_get_file(store, u'css'),
        'homepage': db_get_file(store, u'homepage'),
        'script': db_get_file(store, u'script')
    }

    l10n_dict = NodeL10NFactory(store).localized_dict(language)

    ret = disjoint_union(ro_node, l10n_dict, misc_dict)

    if GLSettings.devel_mode:
        ret['submission_minimum_delay'] = 0

    return ret
Exemplo n.º 3
0
def admin_serialize_notification(store, language):
    config_dict = NotificationFactory(store).admin_export()

    cmd_flags = {
        'reset_templates': False,
        'exception_email_pgp_key_remove': False,
        'smtp_password': '',
    }

    conf_l10n_dict = NotificationL10NFactory(store).localized_dict(language)

    return disjoint_union(config_dict, cmd_flags, conf_l10n_dict)
Exemplo n.º 4
0
def admin_serialize_notification(store, language):
    config_dict = NotificationFactory(store).admin_export()

    cmd_flags = {
        'reset_templates': False,
        'exception_email_pgp_key_remove': False,
        'smtp_password': '',
    }

    conf_l10n_dict = NotificationL10NFactory(store).localized_dict(language)

    return disjoint_union(config_dict, cmd_flags, conf_l10n_dict)
Exemplo n.º 5
0
    'reachable_via_web': bool,
    'anonymize_outgoing_connections': bool
}

AdminNotificationDesc = disjoint_union(
    {
        'server': unicode,
        'port': int,
        'security': unicode,  # 'TLS' or 'SSL' only
        'username': unicode,
        'smtp_password': unicode,
        'source_name': unicode,
        'source_email': email_regexp,
        'disable_admin_notification_emails': bool,
        'disable_custodian_notification_emails': bool,
        'disable_receiver_notification_emails': bool,
        'tip_expiration_threshold': int,
        'notification_threshold_per_hour': int,
        'reset_templates': bool,
        'exception_email_address': email_regexp,
        'exception_email_pgp_key_fingerprint': unicode,
        'exception_email_pgp_key_expiration': unicode,
        'exception_email_pgp_key_public': unicode,
        'exception_email_pgp_key_remove': bool
    },
    {k: unicode
     for k in NotificationL10NFactory.modifiable_keys})

AdminFieldOptionDesc = {
    'id': uuid_regexp_or_empty,
    'label': unicode,