from django.utils.translation import ugettext_lazy as _ from askbot.conf.super_groups import EXTERNAL_SERVICES from askbot.conf import settings as askbot_settings from askbot.deps import livesettings FACEBOOK_SETTINGS = livesettings.ConfigurationGroup( 'FACEBOOK', _("Facebook integration"), super_group=EXTERNAL_SERVICES) askbot_settings.register( livesettings.StringValue( FACEBOOK_SETTINGS, 'FACEBOOK_TOKEN', default='', description=_("Facebook token to access to API."))) askbot_settings.register( livesettings.StringValue(FACEBOOK_SETTINGS, 'FACEBOOK_PAGE', default='', description=_("Facebook page synchronized.")))
"""Settings for LDAP login for Askbot""" from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import EXTERNAL_SERVICES from askbot.deps import livesettings from django.utils.translation import ugettext as _ LDAP_SETTINGS = livesettings.ConfigurationGroup('LDAP_SETTINGS', _('LDAP login configuration'), super_group=EXTERNAL_SERVICES) settings.register( livesettings.BooleanValue( LDAP_SETTINGS, 'USE_LDAP_FOR_PASSWORD_LOGIN', description=_('Use LDAP authentication for the password login'), defaut=False)) settings.register( livesettings.StringValue(LDAP_SETTINGS, 'LDAP_URL', description=_('LDAP URL'), default="ldap://<host>:<port>")) settings.register( livesettings.StringValue(LDAP_SETTINGS, 'LDAP_BASEDN', description=_('LDAP BASE DN'))) settings.register( livesettings.StringValue(LDAP_SETTINGS, 'LDAP_SEARCH_SCOPE',
"""Settings for content moderation and spam control""" from django.utils.translation import ugettext as _ from askbot import const from askbot.deps import livesettings from askbot.conf.settings_wrapper import settings SPAM_AND_MODERATION = livesettings.ConfigurationGroup( 'SPAM_AND_MODERATION', _('Spam control and content moderation')) 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')))
"""Feedback form settings """ import re from django.utils.translation import ugettext_lazy as _ 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 askbot.deps import 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') ) )
"""Group settings""" from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings GROUP_SETTINGS = livesettings.ConfigurationGroup( 'GROUP_SETTINGS', _('Group settings'), super_group=LOGIN_USERS_COMMUNICATION ) settings.register( livesettings.BooleanValue( GROUP_SETTINGS, 'GROUPS_ENABLED', default=False, description=_('Enable user groups'), ) ) # def group_name_update_callback(old_name, new_name): # from askbot.models.tag import clean_group_name # from askbot.models import Group # cleaned_new_name = clean_group_name(new_name.strip()) # # if new_name == '': # #name cannot be empty # return old_name # # group = Group.objects.get_global_group()
""" External service key settings """ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings from django.utils.translation import ugettext_lazy as _ from django.conf import settings as django_settings from askbot.skins import utils as skin_utils LOGIN_PROVIDERS = livesettings.ConfigurationGroup( 'LOGIN_PROVIDERS', _('Login provider setings'), super_group = LOGIN_USERS_COMMUNICATION ) settings.register( livesettings.BooleanValue( LOGIN_PROVIDERS, 'PASSWORD_REGISTER_SHOW_PROVIDER_BUTTONS', default = True, description=_('Show alternative login provider buttons on the password "Sign Up" page'), ) ) #todo: remove this - we don't want the local login button #but instead always show the login/password field when used settings.register( livesettings.BooleanValue( LOGIN_PROVIDERS, 'SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN',
""" Settings for askbot data display and entry """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from django.utils.translation import ugettext as _ from askbot import const FORUM_DATA_RULES = livesettings.ConfigurationGroup('FORUM_DATA_RULES', _('Data entry and display')) settings.register( livesettings.BooleanValue( FORUM_DATA_RULES, 'ENABLE_VIDEO_EMBEDDING', default=False, description=_( 'Enable embedding videos. ' '<em>Note: please read <a href="%(url)s>read this</a> first.</em>') % {'url': const.DEPENDENCY_URLS['embedding-video']})) settings.register( livesettings.BooleanValue( FORUM_DATA_RULES, 'WIKI_ON', default=True, description=_('Check to enable community wiki feature'))) settings.register( livesettings.BooleanValue( FORUM_DATA_RULES,
Q&A website settings - title, desctiption, basic urls keywords """ from urlparse import urlparse 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 askbot.deps import 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,
from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import 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>'), )) settings.register(
""" Settings for making the karma and badge systems visible to the users at a different degree """ from django.utils.translation import ugettext as _ from askbot.conf.settings_wrapper import settings from askbot.deps import 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(
"""Settings for content moderation and spam control""" from django.utils.translation import ugettext as _ from askbot import const from askbot.deps import 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')))
""" Settings responsible for display of questions lists """ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import DATA_AND_FORMATTING from askbot.deps import livesettings from django.utils.translation import ugettext_lazy as _ QUESTION_LISTS = livesettings.ConfigurationGroup( 'QUESTION_LISTS', _('Listings of questions'), super_group=DATA_AND_FORMATTING) settings.register( livesettings.BooleanValue( QUESTION_LISTS, 'ALL_SCOPE_ENABLED', default=True, description=_('Enable "All Questions" selector'), help_text=_('At least one of these selectors must be enabled'))) settings.register( livesettings.BooleanValue( QUESTION_LISTS, 'UNANSWERED_SCOPE_ENABLED', default=True, description=_('Enable "Unanswered Questions" selector'), help_text=_('At least one of these selectors must be enabled'))) settings.register( livesettings.BooleanValue(
"""settings that allow changing of the license clause used in askbot instances""" from askbot import const from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from askbot.skins import utils as skin_utils from django.utils.translation import ugettext as _ from django.conf import settings as django_settings LICENSE_SETTINGS = livesettings.ConfigurationGroup('LICENSE_SETTINGS', _('License settings')) 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'),
from askbot.conf.super_groups import EXTERNAL_SERVICES from askbot.conf import settings as askbot_settings from askbot.deps import livesettings from django.utils.translation import ugettext_lazy as _ SLACK_SETTINGS = livesettings.ConfigurationGroup( 'SLACK', _('Slack integration'), super_group=EXTERNAL_SERVICES ) askbot_settings.register( livesettings.BooleanValue( SLACK_SETTINGS, 'SLACK_ENABLED', default=False, description=_('Enable posting to Slack') ) ) askbot_settings.register( livesettings.StringValue( SLACK_SETTINGS, 'SLACK_USERNAME', default='', description=_('Slack user name'), ) ) askbot_settings.register( livesettings.StringValue(
""" Email related settings """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from askbot import const from django.utils.translation import ugettext as _ from django.conf import settings as django_settings EMAIL_SUBJECT_PREFIX = getattr(django_settings, 'EMAIL_SUBJECT_PREFIX', '') EMAIL = livesettings.ConfigurationGroup( 'EMAIL', _('Email and email alert settings'), ) 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.'))) settings.register( livesettings.IntegerValue( EMAIL, 'MAX_ALERTS_PER_EMAIL', default=7,
""" Settings for minimum reputation required for a variety of actions on the askbot askbot """ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import REP_AND_BADGES from askbot.deps import livesettings from django.utils.translation import ugettext as _ MIN_REP = livesettings.ConfigurationGroup('MIN_REP', _('Karma thresholds'), ordering=0, super_group=REP_AND_BADGES) settings.register( livesettings.IntegerValue(MIN_REP, 'MIN_REP_TO_VOTE_UP', default=15, description=_('Upvote'))) settings.register( livesettings.IntegerValue(MIN_REP, 'MIN_REP_TO_VOTE_DOWN', default=100, description=_('Downvote'))) settings.register( livesettings.IntegerValue( MIN_REP, 'MIN_REP_TO_ANSWER_OWN_QUESTION', default=25,
from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings from askbot.deps.livesettings import BooleanValue from askbot.deps.livesettings import StringValue from django.utils.translation import ugettext_lazy as _ ACCESS_CONTROL = livesettings.ConfigurationGroup( 'ACCESS_CONTROL', _('Access control settings'), super_group=LOGIN_USERS_COMMUNICATION) settings.register( BooleanValue( ACCESS_CONTROL, 'READ_ONLY_MODE_ENABLED', default=False, description=_('Make site read-only'), )) settings.register( 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',
""" External service key settings """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from django.utils.translation import ugettext as _ from django.conf import settings as django_settings from askbot.skins import utils as skin_utils LOGIN_PROVIDERS = livesettings.ConfigurationGroup('LOGIN_PROVIDERS', _('Login provider setings')) settings.register( livesettings.BooleanValue( LOGIN_PROVIDERS, 'PASSWORD_REGISTER_SHOW_PROVIDER_BUTTONS', default=True, description= _('Show alternative login provider buttons on the password "Sign Up" page' ), )) settings.register( livesettings.BooleanValue( LOGIN_PROVIDERS, 'SIGNIN_ALWAYS_SHOW_LOCAL_LOGIN', default=False, description=_( 'Always display local login form and hide "Askbot" button.'), ))
""" Settings for minimum reputation required for a variety of actions on the askbot askbot """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from django.utils.translation import ugettext as _ MIN_REP = livesettings.ConfigurationGroup( 'MIN_REP', _('Minimum reputation required to perform actions'), ordering=0) settings.register( livesettings.IntegerValue(MIN_REP, 'MIN_REP_TO_VOTE_UP', default=15, description=_('Upvote'))) settings.register( livesettings.IntegerValue(MIN_REP, 'MIN_REP_TO_VOTE_DOWN', default=100, description=_('Downvote'))) settings.register( livesettings.IntegerValue( MIN_REP, 'MIN_REP_TO_ANSWER_OWN_QUESTION', default=25, description=_('Answer own question immediately'))) settings.register(
""" User policy settings """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from django.utils.translation import ugettext as _ USER_SETTINGS = livesettings.ConfigurationGroup( 'USER_SETTINGS', _('User policy settings') ) settings.register( livesettings.BooleanValue( USER_SETTINGS, 'EDITABLE_SCREEN_NAME', default=True, description=_('Allow editing user screen name') ) ) settings.register( livesettings.IntegerValue( USER_SETTINGS, 'MIN_USERNAME_LENGTH', hidden=True, default=1, description=_('Minimum allowed length for screen name') ) )
"""External service key settings""" from askbot import const from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from django.utils.translation import ugettext as _ from django.conf import settings as django_settings EXTERNAL_KEYS = livesettings.ConfigurationGroup( 'EXTERNAL_KEYS', _('Keys to connect the site with external ' 'services like Facebook, etc.')) 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=_(
""" Settings for askbot data display and entry """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from askbot import const from askbot.conf.super_groups import DATA_AND_FORMATTING from django.utils.translation import ugettext_lazy as _ 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 = (
""" Q&A website settings - title, desctiption, basic urls keywords """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from django.utils.translation import ugettext as _ QA_SITE_SETTINGS = livesettings.ConfigurationGroup( 'QA_SITE_SETTINGS', _('Q&A forum website parameters and urls')) settings.register( livesettings.StringValue(QA_SITE_SETTINGS, 'APP_TITLE', default=u'Askbot: Open Source Q&A Forum', description=_('Site title for the Q&A forum'))) settings.register( livesettings.StringValue( QA_SITE_SETTINGS, 'APP_KEYWORDS', default=u'Askbot,CNPROG,forum,community', description=_('Comma separated list of Q&A site keywords'))) settings.register( livesettings.StringValue( QA_SITE_SETTINGS, 'APP_COPYRIGHT', default='Copyright Askbot, 2010-2011.', description=_('Copyright message to show in the footer')))
"""External service key settings""" from askbot import const from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import EXTERNAL_SERVICES from askbot.deps import 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'),
""" Email related settings """ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings from askbot import const from django.utils.translation import ugettext_lazy as _ from django.conf import settings as django_settings 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:
"""settings that allow changing of the license clause used in askbot instances""" from askbot import const from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import CONTENT_AND_UI from askbot.deps import livesettings from askbot.skins import utils as skin_utils from django.utils.translation import ugettext as _ from django.conf import settings as django_settings LICENSE_SETTINGS = livesettings.ConfigurationGroup( 'LICENSE_SETTINGS', _('Content LicensContent 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,
""" Settings for content categories. These categories will be applicable to: * Tags * Questions * Users """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings from django.utils.translation import ugettext as _ CATEGORIES = livesettings.ConfigurationGroup('CATEGORIES', _('Categories settings'), ordering=2) settings.register( livesettings.BooleanValue( CATEGORIES, 'ENABLE_CATEGORIES', default=False, description=_('Check to enable categories for content'), )) settings.register( livesettings.IntegerValue( CATEGORIES, 'CATEGORIES_MAX_TREE_DEPTH', default=3, description=_('Number of levels in the categories hierarchy tree'), ))