Exemple #1
0
FORUM_DATA_RULES = livesettings.ConfigurationGroup(
    'FORUM_DATA_RULES',
    _('Data entry and display rules'),
    super_group=DATA_AND_FORMATTING
)

EDITOR_CHOICES = (
    ('markdown', _('Markdown')),
    ('tinymce', _('WYSIWYG (tinymce)')),
)

settings.register(
    livesettings.StringValue(
        FORUM_DATA_RULES,
        'EDITOR_TYPE',
        default='markdown',
        choices=EDITOR_CHOICES,
        description=_('Editor for the posts')
    )
)

COMMENTS_EDITOR_CHOICES = (
    ('plain-text', 'Plain text editor'),
    ('rich-text', 'Same editor as for questions and answers')
)

settings.register(
    livesettings.StringValue(
        FORUM_DATA_RULES,
        'COMMENTS_EDITOR_TYPE',
        default='plain-text',
        'ALLOW_EMAIL_ADDRESS_IN_USERNAME',
        default=True,
        description=_('Allow email address in user name')))

settings.register(
    livesettings.BooleanValue(
        USER_SETTINGS,
        'ALLOW_ACCOUNT_RECOVERY_BY_EMAIL',
        default=True,
        description=_('Allow account recovery by email')))

settings.register(
    livesettings.StringValue(
        USER_SETTINGS,
        'WHO_CAN_TERMINATE_ACCOUNTS',
        choices=(('admins', _('administrators')),
                 ('users', _('account owners and administrators'))),
        default='admins',
        description=_('Who can terminate user accounts')))

settings.register(
    livesettings.BooleanValue(
        USER_SETTINGS,
        'ALLOW_ADD_REMOVE_LOGIN_METHODS',
        default=True,
        description=_('Allow adding and removing login methods')))

settings.register(
    livesettings.IntegerValue(
        USER_SETTINGS,
        'MIN_USERNAME_LENGTH',
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings

from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
from livesettings import values as livesettings

QA_SITE_SETTINGS = livesettings.ConfigurationGroup(
    'QA_SITE_SETTINGS',
    _('URLS, keywords & greetings'),
    super_group=CONTENT_AND_UI)

settings.register(
    livesettings.StringValue(QA_SITE_SETTINGS,
                             'APP_TITLE',
                             default=_('My site'),
                             description=_('Site title for the Q&A forum')))

settings.register(
    livesettings.StringValue(
        QA_SITE_SETTINGS,
        'APP_KEYWORDS',
        default='Askbot,forum,community',
        description=_('Comma separated list of Q&A site keywords')))

settings.register(
    livesettings.StringValue(
        QA_SITE_SETTINGS,
        'APP_COPYRIGHT',
        default='Copyright Askbot, 2010-2020.',
        description=_('Copyright message to show in the footer')))
Exemple #4
0
from askbot.skins import utils as skin_utils

LICENSE_SETTINGS = livesettings.ConfigurationGroup('LICENSE_SETTINGS',
                                                   _('Content License'),
                                                   super_group=CONTENT_AND_UI)

settings.register(
    livesettings.BooleanValue(
        LICENSE_SETTINGS,
        'USE_LICENSE',
        description=_('Show license clause in the site footer'),
        default=True))

settings.register(
    livesettings.StringValue(LICENSE_SETTINGS,
                             'LICENSE_ACRONYM',
                             description=_('Short name for the license'),
                             default='cc-by-sa'))

settings.register(
    livesettings.StringValue(
        LICENSE_SETTINGS,
        'LICENSE_TITLE',
        description=_('Full name of the license'),
        default=_('Creative Commons Attribution Share Alike 3.0'),
    ))

settings.register(
    livesettings.BooleanValue(LICENSE_SETTINGS,
                              'LICENSE_USE_URL',
                              description=_('Add link to the license page'),
                              default=True))
settings.register(
    livesettings.BooleanValue(LOGIN_PROVIDERS,
                              'SIGNIN_CUSTOM_OPENID_ENABLED',
                              default=False,
                              description=_('Enable custom OpenID login')))

if module_exists('cas'):
    settings.register(
        livesettings.BooleanValue(LOGIN_PROVIDERS,
                                  'SIGNIN_CAS_ENABLED',
                                  default=False,
                                  description=_('Enable CAS authentication')))
    settings.register(
        livesettings.StringValue(LOGIN_PROVIDERS,
                                 'CAS_SERVER_URL',
                                 default='',
                                 description=_('CAS server url')))
    settings.register(
        livesettings.StringValue(LOGIN_PROVIDERS,
                                 'CAS_SERVER_NAME',
                                 default='CAS Server',
                                 description=_('CAS server name')))
    settings.register(
        livesettings.StringValue(
            LOGIN_PROVIDERS,
            'CAS_PROTOCOL_VERSION',
            default='3',
            choices=(('1', '1'), ('2', '2'), ('3', '3')),
            description=_('CAS protocol version'),
        ))
    settings.register(
Exemple #6
0
        description=_('Automatically create user accounts when possible'),
        default=False,
        help_text=_(
            'Potentially reduces number of steps in the registration process '
            'but can expose personal information, e.g. when LDAP login name '
            'is the same as email address or real name.')))

LDAP_PROTOCOL_VERSION_CHOICES = (('3', _('Version 3')),
                                 ('2',
                                  _('Version 2 (insecure and deprecated)!!!')))

settings.register(
    livesettings.StringValue(
        LDAP_SETTINGS,
        'LDAP_PROTOCOL_VERSION',
        default='3',
        choices=LDAP_PROTOCOL_VERSION_CHOICES,
        description=_('LDAP protocol version'),
        help_text=_('Note that Version 2 protocol is not secure!!! '
                    'Do not use it on unprotected network.')))

settings.register(
    livesettings.StringValue(LDAP_SETTINGS,
                             'LDAP_URL',
                             description=_('LDAP URL'),
                             default="ldap://<host>:<port>"))

settings.register(
    livesettings.StringValue(LDAP_SETTINGS,
                             'LDAP_ENCODING',
                             description=_('LDAP encoding'),
                             default='utf-8',
from livesettings import values as livesettings
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings

EXTERNAL_KEYS = livesettings.ConfigurationGroup(
    'EXTERNAL_KEYS',
    _('Keys for external services'),
    super_group=EXTERNAL_SERVICES)

settings.register(
    livesettings.StringValue(
        EXTERNAL_KEYS,
        'GOOGLE_SITEMAP_CODE',
        description=_('Google site verification key'),
        help_text=_('This key helps google index your site '
                    'please obtain is at '
                    '<a href="%(url)s?hl=%(lang)s">'
                    'google webmasters tools site</a>') % {
                        'url': const.DEPENDENCY_URLS['google-webmaster-tools'],
                        'lang': django_settings.LANGUAGE_CODE,
                    }))

settings.register(
    livesettings.StringValue(
        EXTERNAL_KEYS,
        'GOOGLE_ANALYTICS_KEY',
        description=_('Google Analytics key'),
        help_text=_('Obtain is at <a href="%(url)s">'
                    'Google Analytics</a> site, if you '
                    'wish to use Google Analytics to monitor '
                    'your site') % {
    'ACCESS_CONTROL',
    _('Access control settings'),
    super_group=LOGIN_USERS_COMMUNICATION)

settings.register(
    livesettings.BooleanValue(
        ACCESS_CONTROL,
        'READ_ONLY_MODE_ENABLED',
        default=False,
        description=_('Make site read-only'),
    ))

settings.register(
    livesettings.StringValue(
        ACCESS_CONTROL,
        'READ_ONLY_MESSAGE',
        default=_('The site is temporarily read-only. '
                  'Only viewing of the content is possible at the moment.')))

settings.register(
    livesettings.BooleanValue(
        ACCESS_CONTROL,
        'ASKBOT_CLOSED_FORUM_MODE',
        default=False,
        description=_('Allow only registered user to access the forum'),
    ))

settings.register(
    livesettings.BooleanValue(
        ACCESS_CONTROL,
        'NEW_REGISTRATIONS_DISABLED',
Exemple #9
0
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
from livesettings import values as livesettings
from askbot import const

EMAIL_SUBJECT_PREFIX = getattr(django_settings, 'EMAIL_SUBJECT_PREFIX', '')

EMAIL = livesettings.ConfigurationGroup('EMAIL',
                                        _('Email and email alert settings'),
                                        super_group=LOGIN_USERS_COMMUNICATION)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'EMAIL_SUBJECT_PREFIX',
        default=EMAIL_SUBJECT_PREFIX,
        description=_('Prefix for the email subject line'),
        help_text=_('This setting takes default from the django setting '
                    'EMAIL_SUBJECT_PREFIX. A value entered here will override '
                    'the default.')))


def get_default_admin_email():
    try:
        return django_settings.ADMINS[0][1]
    except (AttributeError, IndexError):
        return ''


settings.register(
    livesettings.StringValue(
        EMAIL,
Exemple #10
0
from django.core.validators import validate_email, ValidationError
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
from livesettings import values as livesettings

FEEDBACK = livesettings.ConfigurationGroup(
    'FEEDBACK', _('Feedback settings'), super_group=LOGIN_USERS_COMMUNICATION)

FEEDBACK_MODE_CHOICES = (('open', _('Anyone')),
                         ('auth-only', _('Only authenticated users')),
                         ('disabled', _('Nobody, disable feedback form')))

settings.register(
    livesettings.StringValue(FEEDBACK,
                             'FEEDBACK_MODE',
                             default='open',
                             choices=FEEDBACK_MODE_CHOICES,
                             description=_('Who can send feedback')))

settings.register(
    livesettings.StringValue(
        FEEDBACK,
        'FEEDBACK_SITE_URL',
        description=_('Feedback site URL'),
        help_text=_('If left empty, a simple internal feedback form '
                    'will be used instead')))

settings.register(
    livesettings.LongStringValue(
        FEEDBACK,
        'FEEDBACK_PAGE_MESSAGE',
from livesettings import values as livesettings
from askbot.conf.super_groups import REP_AND_BADGES

KARMA_AND_BADGE_VISIBILITY = livesettings.ConfigurationGroup(
    'KARMA_AND_BADGE_VISIBILITY',
    _('Karma & Badge visibility'),
    super_group=REP_AND_BADGES)

settings.register(
    livesettings.StringValue(
        KARMA_AND_BADGE_VISIBILITY,
        'KARMA_MODE',
        default='public',
        choices=(
            ('public', 'show publicly'),
            ('private', 'show to owners only'),
            ('hidden', 'hide completely'),
        ),  # TODO: Later implement hidden mode
        description=_("Visibility of karma"),
        clear_cache=True,
        help_text=_(
            "User's karma may be shown publicly or only to the owners")))

settings.register(
    livesettings.StringValue(
        KARMA_AND_BADGE_VISIBILITY,
        'BADGES_MODE',
        default='public',
        choices=(('public', 'show publicly'),
                 ('hidden',
                  'hide completely')),  # TODO: Later implement private mode
Exemple #12
0
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
from livesettings import values as livesettings

EMAIL_TEXT = livesettings.ConfigurationGroup(
            'EMAIL_TEXT',
            _('Email template phrases'),
            super_group=LOGIN_USERS_COMMUNICATION
        )

settings.register(
    livesettings.StringValue(
        EMAIL_TEXT,
        'EMAIL_TEXT_SHORT_WELCOME',
        description=_('Short welcome message, for subject line'),
        default=_('Welcome to {{ SITE_NAME }}!'),
        help_text=_('<b>NOTE: All email text settings allow placeholders: '
                    '{{ USER_NAME }}, {{ SITE_NAME }} and {{ SITE_LINK }}.</b>')
    )
)

settings.register(
    livesettings.LongStringValue(
        EMAIL_TEXT,
        'EMAIL_TEXT_LONG_WELCOME',
        description=_('Longer welcome message, for email body'),
        default=_('<p>Please visit {{ SITE_NAME }} at {{ SITE_LINK }}, we '
                  'look forward to your posts.</p>'),
    )
)
    scope_switch_name = new_value.upper() + '_SCOPE_ENABLED'
    is_enabled = getattr(settings, scope_switch_name)
    if is_enabled is False:
        settings.update(scope_switch_name, True)
    return new_value


SCOPE_CHOICES_AUTHENTICATED = (('all', _('All Questions')),
                               ('unanswered', _('Unanswered Questions')),
                               ('followed', _('Followed Questions')))

settings.register(
    livesettings.StringValue(
        QUESTION_LISTS,
        'DEFAULT_SCOPE_AUTHENTICATED',
        choices=SCOPE_CHOICES_AUTHENTICATED,
        default='all',
        description=_(
            'Default questions selector for the authenticated users'),
        update_callback=enable_default_selector_if_disabled))

SCOPE_CHOICES_ANONYMOUS = (  # Anonymous users can't see followed questions
    ('all', _('All Questions')),
    ('unanswered', _('Unanswered Questions')),
)

settings.register(
    livesettings.StringValue(
        QUESTION_LISTS,
        'DEFAULT_SCOPE_ANONYMOUS',
        choices=SCOPE_CHOICES_ANONYMOUS,
        default='all',
Exemple #14
0
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
from livesettings import ConfigurationGroup, values


WORDS = ConfigurationGroup(
    'WORDS',
    _('Site terms vocabulary'),
    super_group=CONTENT_AND_UI
)

settings.register(
    values.StringValue(
        WORDS,
        'WORDS_ASK_YOUR_QUESTION',
        default=_('Ask Your Question'),
        description=_('Ask Your Question'),
        help_text=_('Used on a button'),
        localized=True
    )
)

settings.register(
    values.StringValue(
        WORDS,
        'WORDS_PLEASE_ENTER_YOUR_QUESTION',
        default=_('Please enter your question'),
        description=_('Please enter your question'),
        localized=True
    )
)
Exemple #15
0
"""Settings for content moderation and spam control"""
from django.utils.translation import ugettext_lazy as _
from askbot import const
from livesettings import values as livesettings
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import EXTERNAL_SERVICES

SPAM_AND_MODERATION = livesettings.ConfigurationGroup(
    'SPAM_AND_MODERATION',
    _('Akismet spam protection'),
    super_group=EXTERNAL_SERVICES)

settings.register(
    livesettings.BooleanValue(
        SPAM_AND_MODERATION,
        'USE_AKISMET',
        description=_(
            'Enable Akismet spam detection(keys below are required)'),
        default=False,
        help_text=_('To get an Akismet key please visit '
                    '<a href="%(url)s">Akismet site</a>') %
        {'url': const.DEPENDENCY_URLS['akismet']}))

settings.register(
    livesettings.StringValue(SPAM_AND_MODERATION,
                             'AKISMET_API_KEY',
                             description=_('Akismet key for spam detection')))