def register_badge_settings(badge_slug=None, badge_name=None, params=None): settings.register( BooleanValue( BADGES, badge_slug + '_BADGE_ENABLED', default=True, description=_('Enable "%s" badge') % badge_name ) ) if params is None: return for param_slug, param_data in params.items(): param_description = param_data[0] param_default = param_data[1] settings.register( IntegerValue( BADGES, badge_slug + '_BADGE_' + param_slug, description=string_concat(badge_name, ': ', param_description), default=param_default))
from livesettings import config_register, StringValue, IntegerValue, BooleanValue, MultipleStringValue from satchmo_store.shop.config import SHOP_GROUP from django.utils.translation import ugettext_lazy as _ config_register( BooleanValue( SHOP_GROUP, 'AUTHENTICATION_REQUIRED', description=_("Only authenticated users can check out"), help_text= _("Users will be required to authenticate (and create an account if neccessary) before checkout." ), default=False, )) config_register( MultipleStringValue( SHOP_GROUP, 'REQUIRED_BILLING_DATA', description=_("Required billing data"), help_text= _("Users may be required to provide some set of billing address. Other fields are optional. " "You may shorten the checkout process here, but be careful, as this may leave you orders " "with almost no customer data! Some payment modules may override this setting." ), default=('email', 'first_name', 'last_name', 'phone', 'street1', 'city', 'postal_code', 'country'), choices=(('email', _("Email")), ('title', _("Title")), ('first_name', _("First name")), ('last_name', _("Last name")),
"""Adds Configuration-module specific configuration options""" from django.utils.translation import ugettext_lazy as _ from livesettings import BooleanValue, config_register from product.config import PRODUCT_GROUP config_register( BooleanValue( PRODUCT_GROUP, 'SEARCH_SHOW_PRODUCTVARIATIONS', description=_("Show product variations in search results?"), help_text=_( "If yes, the product variations will show up in searches."), default=True))
from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from livesettings import (ConfigurationGroup, BooleanValue, StringValue, LongStringValue) from django.utils.translation import ugettext_lazy as _ from django.utils.translation import string_concat register = settings.register ACCESS_CONTROL = ConfigurationGroup('ACCESS_CONTROL', _('Access control settings'), super_group=LOGIN_USERS_COMMUNICATION) register(BooleanValue(ACCESS_CONTROL, 'READ_ONLY_MODE_ENABLED', default=False, description=_('Make site read-only'))) register(StringValue( ACCESS_CONTROL, 'READ_ONLY_MESSAGE', default=_('The site is temporarily read-only. Only viewing of the content is possible at the moment.'))) register(BooleanValue(ACCESS_CONTROL, 'ASKBOT_CLOSED_FORUM_MODE', default=False, description=_('Allow only registered user to access the forum'))) EMAIL_VALIDATION_CASE_CHOICES = ( ('nothing', _('nothing - not required')), ('see-content', _('account registration')), # 'post-content', _('posting content'), ) register(StringValue(ACCESS_CONTROL, 'REQUIRE_VALID_EMAIL_FOR', default='nothing', choices=EMAIL_VALIDATION_CASE_CHOICES, description=_('Require valid email for')))
for i in range(0, len(regex_list)): re.compile(regex_list[i].strip()) return args[1] except Exception: # The regex is invalid, so we overwrite it with empty string return "" settings.register( BooleanValue(MARKUP, 'MARKUP_CODE_FRIENDLY', description=_('Enable code-friendly Markdown'), help_text=_('If checked, underscore characters will not ' 'trigger italic or bold formatting - ' 'bold and italic text can still be marked up ' 'with asterisks. Note that "MathJax support" ' 'implicitly turns this feature on, because ' 'underscores are heavily used in LaTeX input.'), default=False)) settings.register( BooleanValue( MARKUP, 'ENABLE_MATHJAX', description=_('Mathjax support (rendering of LaTeX)'), help_text=_('If you enable this feature, ' '<a href="%(url)s">mathjax</a> must be ' 'installed on your server in its own directory.') % { 'url': const.DEPENDENCY_URLS['mathjax'], },
DOMAIN_GROUP = ConfigurationGroup('DOMAIN', 'Site domain', ordering=0) config_register( StringValue(DOMAIN_GROUP, 'SITE_DOMAIN', description='Site domain to be referenced in outgoing email.', default='localhost:8000')) # Email settings EMAIL_GROUP = ConfigurationGroup('EMAIL', 'Email', ordering=1) config_register( BooleanValue( EMAIL_GROUP, 'EMAIL_ENABLED', description='Enable email?', help_text= 'If enabled, notifications and activation messages will be sent via email.', default=False, ordering=0)) config_register( StringValue(EMAIL_GROUP, 'EMAIL_HOST', description='Hostname or IP of the SMTP server.', default='localhost', ordering=1)) config_register( PositiveIntegerValue(EMAIL_GROUP, 'EMAIL_PORT', description='Port number of the SMTP server.',
from livesettings import ConfigurationGroup, config_register_list, IntegerValue, BooleanValue from django.utils.translation import ugettext_lazy as _ THUMB_GROUP = ConfigurationGroup('THUMBNAIL', _('Thumbnail Settings')) config_register_list( IntegerValue( THUMB_GROUP, 'IMAGE_QUALITY', description=_("Thumbnail quality"), help_text= _("Use a 1-100 value here, which will change the quality of JPG thumbnails created for products and categories." ), default=75, ordering=0), BooleanValue(THUMB_GROUP, 'RENAME_IMAGES', description=_("Rename product images?"), help_text=_("Automatically rename product images on upload?"), default=True))
""" Social sharing settings """ from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import EXTERNAL_SERVICES from livesettings import ConfigurationGroup, BooleanValue, StringValue SOCIAL_SHARING = ConfigurationGroup('SOCIAL_SHARING', _('Content sharing'), super_group=EXTERNAL_SERVICES) settings.register( BooleanValue(SOCIAL_SHARING, 'RSS_ENABLED', default=True, description=_('Check to enable RSS feeds'))) settings.register( StringValue(SOCIAL_SHARING, 'SHARING_SUFFIX_TEXT', default='', description=_('Hashtag or suffix to sharing messages'))) settings.register( BooleanValue( SOCIAL_SHARING, 'ENABLE_SHARING_FACEBOOK', default=True, description=_('Check to enable sharing of questions on Facebook')))
LongStringValue( MODERATION, 'FORBIDDEN_PHRASES', default='', description=_('Reject all posts with these phrases'), help_text=_('Enter one phrase per line (case-insensitive). ' 'Posts with these phrases will be rejected ' 'without moderation.' ) ) ) settings.register( BooleanValue( MODERATION, 'MODERATE_IMAGES', default=False, description=_('Enable image moderation') ) ) settings.register( BooleanValue( MODERATION, 'MODERATE_LINKS', default=False, description=_('Enable link moderation') ) ) settings.register( BooleanValue(
from askbot.conf.super_groups import EXTERNAL_SERVICES from livesettings import ConfigurationGroup, BooleanValue, StringValue SPAM_AND_MODERATION = ConfigurationGroup( 'SPAM_AND_MODERATION', _('Akismet spam protection'), super_group=EXTERNAL_SERVICES ) settings.register( 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( StringValue( SPAM_AND_MODERATION, 'AKISMET_API_KEY', description=_('Akismet key for spam detection') ) )
# this is so that the translation utility will pick up the string gettext = lambda s: s _strings = (gettext('CreditCard'), gettext('Credit Card')) PAYMENT_GROUP = ConfigurationGroup('PAYMENT_PAYFLOWPRO', _('PayflowPro Payment Settings'), ordering=101) config_register_list( BooleanValue( PAYMENT_GROUP, 'LIVE', description=_("Accept real payments"), help_text=_( "False if you want to submit to the test urls. NOTE: Look " "at the PayflowPro developer's guide " "(https://cms.paypal.com/us/cgi-bin/?cmd=_render-content" "&content_ID=developer/howto_gateway_payflowpro) for the " "list of valid credit card numbers."), default=False), ModuleValue(PAYMENT_GROUP, 'MODULE', description=_('Implementation module'), hidden=True, default='payment.modules.payflowpro'), BooleanValue(PAYMENT_GROUP, 'CAPTURE', description=_('Capture Payment immediately?'), default=True, help_text=_('IMPORTANT: If false, a capture attempt will be '
description='Password', help_text='Enter the password to access this mail account.', render_value=True, ordering = 1 )) config_register(StringValue( RECEIVEMAIL_GROUP, 'SERVER', description=_("Server"), help_text=_("Enter the url of the mail server."), ordering = 2 )) config_register(IntegerValue( RECEIVEMAIL_GROUP, 'PORT', description=_("Port"), help_text=_("Enter the port number of the mail server."), ordering = 3 )) config_register(BooleanValue( RECEIVEMAIL_GROUP, 'SSL_ENABLED', description=_("SSL Enabled"), help_text=_("Check to enable SSL transfer"), default=False, ordering = 4 ))
"""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 livesettings import ConfigurationGroup, BooleanValue, StringValue register = settings.register GROUP_SETTINGS = ConfigurationGroup('GROUP_SETTINGS', _('Group settings'), super_group=LOGIN_USERS_COMMUNICATION) register( 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() group.name = cleaned_new_name group.save() return new_name
for key, value in LARGE_SITE_MODE_SETTINGS.items(): settings.update(key, value) else: for key in LARGE_SITE_MODE_SETTINGS: settings.reset(key) return new_value SITE_MODES = ConfigurationGroup('SITE_MODES', _('Bootstrap mode'), super_group=REP_AND_BADGES) settings.register( BooleanValue( SITE_MODES, 'ACTIVATE_LARGE_SITE_MODE', default=False, description=_('Activate a "Large site" mode'), help_text=_( "\"Large site\" mode increases reputation and certain badge " "thresholds, to values, more suitable " "for the larger communities, " "<strong>WARNING:</strong> your current values for " "Minimum reputation, " "Badge Settings and " "Vote Rules will " "be changed after you modify this setting."), update_callback=bootstrap_callback))
#### SHOP Group #### LOGO_URI = config_register( StringValue(SHOP_GROUP, 'LOGO_URI', description=_("URI to the logo for the store"), help_text=_( ("For example http://www.example.com/images/logo.jpg or " "file:///var/www/html/images/logo.jpg")), default=default_icon_url)) ENFORCE_STATE = config_register( BooleanValue( SHOP_GROUP, 'ENFORCE_STATE', description=_('State required?'), help_text= _("Require a state during registration/checkout for countries that have states?" ), default=True)) SHOW_SITE = config_register( BooleanValue( SHOP_GROUP, 'SHOW_SITE', description=_('Show Site Field?'), help_text= _("Should the Site field be displayed in the admin lists? A server restart is required for this to take effect." ), default=True)) config_register(
'SITE_DOMAIN', description=_('Site domain to be referenced in outgoing email.'), default='localhost:8000' )) # Email settings EMAIL_GROUP = ConfigurationGroup( 'EMAIL', _('Email'), ordering=1 ) config_register(BooleanValue( EMAIL_GROUP, 'EMAIL_ENABLED', description=_('Enable email?'), help_text=_('If enabled, notifications and activation messages will be sent via email.'), default=False, ordering=0 )) config_register(StringValue( EMAIL_GROUP, 'EMAIL_HOST', description=_('Hostname or IP of the SMTP server.'), default='localhost', ordering=1 )) config_register(PositiveIntegerValue( EMAIL_GROUP, 'EMAIL_PORT',
PRODUCT_GROUP, 'NUM_PAGINATED', description=_("Number featured"), help_text=_("Number of featured items to display on each page"), default=10), MultipleStringValue( PRODUCT_GROUP, 'MEASUREMENT_SYSTEM', description=_("Measurement System"), help_text=_("Default measurement system to use for products."), choices=[('metric', _('Metric')), ('imperial', _('Imperial'))], default="imperial"), BooleanValue( PRODUCT_GROUP, 'NO_STOCK_CHECKOUT', description=_("Allow checkout with 0 inventory?"), help_text= _("If yes, then customers can buy even if your inventory is 0 for a product." ), default=True), BooleanValue( PRODUCT_GROUP, 'RANDOM_FEATURED', description=_("Random Display"), help_text=_("Enable random display of featured products on home page"), default=False), BooleanValue( PRODUCT_GROUP, 'TRACK_INVENTORY', description=_("Track inventory levels?"), help_text=_( "If no, then inventory will not be tracked for products sold."),