示例#1
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from livesettings import ConfigurationGroup
from livesettings import values
from django.utils.translation import ugettext_lazy as _
from askbot.conf.super_groups import CONTENT_AND_UI

SIDEBAR_MAIN = ConfigurationGroup('SIDEBAR_MAIN',
                                  _('Main page sidebar'),
                                  super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_MAIN,
        'SIDEBAR_MAIN_HEADER',
        description=_('Custom sidebar header'),
        default='',
        localized=True,
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.BooleanValue(
        SIDEBAR_MAIN,
        'SIDEBAR_MAIN_HEADER_ANON_ONLY',
        description=_('Show above only to anonymous users'),
示例#2
0
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, MultipleStringValue
from django.utils.translation import ugettext_lazy as _

# First, setup a grup to hold all our possible configs
SATCHMO_SHIP_GROUP = ConfigurationGroup(
    'satchmo_ship',  # key: internal name of the group to be created
    _('Satchmo Fulfillment Settings'
      ),  # name: verbose name which can be automatically translated
    ordering=0  # ordering: order of group in the list (default is 1)
)

# Another example of allowing the user to select from several values
config_register(
    MultipleStringValue(
        SATCHMO_SHIP_GROUP,
        'USPS_SERVICES',
        description=_("USPS Services"),
        help_text=_("Which USPS services are available to ship with?"),
        choices=[
            ('usps_parcel_select', _('Parcel Select')),
            ('usps_priority_first_class', _('Priority or 1st Class')),  #3day
            ('usps_priority', _('Priority')),
            ('usps_express', _('Express')),
            ('usps_first_class_intl', _('1st Class International')),
            ('usps_priority_intl', _('Priority International')),
            ('usps_express_intl', _('Express International'))
        ]))
'''
GROUND 	        Ground/Home         Delivery	Ground	Parcel Select 	Ground Basic	Regular Parcel
3DAY	        Express Saver	    3 Day Select	Priority or 1st Class	Ground Early	Expedited Parcel
2DAY	        2Day	            2nd Day Air	Priority	Priority Noon	Priority
示例#3
0
# -*- coding: utf-8 -*-
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, PercentValue, StringValue
from django.utils.translation import ugettext_lazy as _

# First, setup a grup to hold all our possible configs
MYAPP_GROUP = ConfigurationGroup(
    'MyApp',  # key: internal name of the group to be created
    u'Настройки сайта',  # name: verbose name which can be automatically translated
    ordering=0  # ordering: order of group in the list (default is 1)
)

config_register(
    StringValue(MYAPP_GROUP,
                'EMAIL',
                description=u'Email администратора',
                help_text=u"Почта, куда будут приходить заявки.",
                default='*****@*****.**'))

config_register(
    StringValue(MYAPP_GROUP,
                'PHONE',
                description=u'Телефон',
                help_text=u"Для отображения на сайте",
                default='8 (926) 555-55-55'))

config_register(
    StringValue(MYAPP_GROUP,
                'ORDERS_COUNT',
                description=u'Кол-во заказов выполненных',
                help_text=u"Для отображения в шапке сайта",
                default='986'))
示例#4
0
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, MultipleStringValue
from django.utils.translation import ugettext_lazy as _
from livesettings.values import *

# First, setup a grup to hold all our possible configs
FATTURA_GROUP = ConfigurationGroup(
    'Fattura',  # key: internal name of the group to be created
    _('Configurazione documento'
      ),  # name: verbose name which can be automatically translated
    ordering=0  # ordering: order of group in the list (default is 1)
)

config_register(
    StringValue(FATTURA_GROUP,
                'RAGIONESOCIALE',
                description=_("ragione sociale azienda"),
                help_text=_("ragione sociale."),
                default=""))

config_register(
    BooleanValue(FATTURA_GROUP,
                 'Iscrizione a gestione separata ',
                 description=_("iscrizione a gestione separata"),
                 help_text=_("iscrizione a gestione separata."),
                 default=False))
示例#5
0
"""
Sidebar settings
"""
from django.utils.translation import ugettext_lazy as _
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
from livesettings import ConfigurationGroup
from livesettings import values

SIDEBAR_QUESTION = ConfigurationGroup(  # shitty name - why sidebar?
    'SIDEBAR_QUESTION',
    _('Question page banners and sidebar'),
    super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_QUESTION,
        'QUESTION_PAGE_TOP_BANNER',
        description=_('Top banner'),
        default='',
        localized=True,
        help_text=_('When using this option, please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.BooleanValue(
        SIDEBAR_QUESTION,
        'QUESTION_PAGE_TOP_BANNER_ANON_ONLY',
        default=False,
        description=_('Show above only to anonymous users'),
示例#6
0
from django.utils.translation import ugettext_lazy as _
from livesettings import ConfigurationGroup, PositiveIntegerValue, config_register

EVENT_GROUP = ConfigurationGroup('EVENTS',
                                 _('Event module settings'),
                                 ordering=0)

config_register(
    PositiveIntegerValue(EVENT_GROUP,
                         'FEATURED_EVENT_ID',
                         description=_("Featured Event"),
                         help_text=_("Primary key of the featured event"),
                         default=1))
示例#7
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from livesettings import ConfigurationGroup, values
from django.utils.translation import ugettext_lazy as _
from askbot.conf.super_groups import CONTENT_AND_UI

SIDEBAR_PROFILE = ConfigurationGroup('SIDEBAR_PROFILE',
                                     _('User profile sidebar'),
                                     super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_PROFILE,
        'SIDEBAR_PROFILE',
        description=_('Custom sidebar'),
        default='',
        localized=True,
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.BooleanValue(SIDEBAR_PROFILE,
                        'SIDEBAR_PROFILE_ANON_ONLY',
                        description=_('Show above only to anonymous users'),
                        default=False))
示例#8
0
"""
General skin settings
"""
from django.utils.translation import ugettext_lazy as _
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'),
示例#9
0
                (r'[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}'
                 r'([a-zA-Z0-9]?){0,16}'),
                message=_(u"Invalid IBAN code. Please make sure to remove "
                          u"all spaces")))
        return super(IBANValue, self).make_field(**kwargs)


class EmailValue(StringValue):
    def make_field(self, **kwargs):
        validators = kwargs.setdefault('validators', [])
        validators.append(validate_email)
        return super(EmailValue, self).make_field(**kwargs)


SHOP_CONFIG = ConfigurationGroup('SHOP_CONFIG',
                                 _(u'Shop configuration'),
                                 ordering=0)

config_register(
    StringValue(
        SHOP_CONFIG,
        'SHOP_NAME',
        description=_(u'Shop name'),
        help_text=_(u'The name of the site, shown on all pages and mails'),
        default=u"Sho Name"))

config_register(
    IBANValue(SHOP_CONFIG,
              'IBAN',
              description=_(u'IBAN'),
              help_text=_(
示例#10
0
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, MultipleStringValue, ModuleValue
from django.utils.translation import ugettext_lazy as _

# First, setup a grup to hold all our possible configs
MYAPP_GROUP = ConfigurationGroup('MyApp', _('My App Settings'), ordering=0)

# Now, add our number of images to display value
# If a user doesn't enter a value, default to 5
config_register(
    PositiveIntegerValue(
        MYAPP_GROUP,
        'NUM_IMAGES',
        description=_('Number of images to display'),
        help_text=_("How many images to display on front page."),
        default=5))

# Another example of allowing the user to select from several values
config_register(
    MultipleStringValue(MYAPP_GROUP,
                        'MEASUREMENT_SYSTEM',
                        description=_("Measurement System"),
                        help_text=_("Default measurement system to use."),
                        choices=[('metric', _('Metric')),
                                 ('imperial', _('Imperial'))],
                        default="imperial"))

config_register(
    ModuleValue(
        MYAPP_GROUP,
        'MODULE',
        #description=_("Measurement System"),
示例#11
0
#Configuration for django-livesettings.
#http://django-livesettings.readthedocs.org
#pylint: disable=E1102
#        '_ is not callable'
from livesettings import config_register, ConfigurationGroup, StringValue, \
    BooleanValue, PasswordValue, IntegerValue
from django.utils.translation import ugettext_lazy as _

RECEIVEMAIL_GROUP = ConfigurationGroup(
    'ReceiveMail',               # key: internal name of the group to be created
    _('Receiving email Settings (POP3)'),  # name: verbose name which can be automatically translated
    ordering=0             # ordering: order of group in the list (default is 1)
    )

config_register(StringValue(
    RECEIVEMAIL_GROUP,           # group: object of ConfigurationGroup created above
        'USERNAME',      # key:   internal name of the configuration value to be created
        description = _('Username'),              # label for the value
        help_text = _("Enter the Username used to access the email account."),  # help text
        ordering = 0
    ))

config_register(PasswordValue(
    RECEIVEMAIL_GROUP,
        'PASSWORD',
        description='Password',
        help_text='Enter the password to access this mail account.',
        render_value=True,
        ordering = 1
    ))
示例#12
0
from decimal import Decimal
from django.utils.translation import ugettext_lazy as _
from livesettings import (config_register, ConfigurationGroup, DecimalValue,
                          StringValue)

BANNERS_INFO = ConfigurationGroup('BANNERS_INFO',
                                  _(u'Banners info'),
                                  ordering=0)

config_register(
    DecimalValue(BANNERS_INFO,
                 'NUM_MAX',
                 description=_(u'Offers in splash page'),
                 help_text=_(
                     u"sets the maximum number of offers to be shown in the "
                     u"splash page"),
                 default=Decimal('3')))

# SOCIALS_INFO configs
SOCIALS_INFO = ConfigurationGroup('SOCIALS_INFO',
                                  _('Socials urls info'),
                                  ordering=0)

# facebook
config_register(
    StringValue(
        SOCIALS_INFO,
        'FACEBOOK_URL',
        description=_(u'Facebook url'),
        help_text=_(u"Insert personal facebook url"),
        default="",
示例#13
0
"""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
示例#14
0
"""
Sidebar settings
"""
from django.utils.translation import ugettext_lazy as _
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
from livesettings import ConfigurationGroup
from livesettings import values

LEADING_SIDEBAR = ConfigurationGroup('LEADING_SIDEBAR',
                                     _('Common left sidebar'),
                                     super_group=CONTENT_AND_UI)

settings.register(
    values.BooleanValue(
        LEADING_SIDEBAR,
        'ENABLE_LEADING_SIDEBAR',
        description=_('Enable left sidebar'),
        default=False,
    ))

settings.register(
    values.LongStringValue(
        LEADING_SIDEBAR,
        'LEADING_SIDEBAR',
        description=_('HTML for the left sidebar'),
        default='',
        help_text=_('Use this area to enter content at the LEFT sidebar'
                    'in HTML format.  When using this option, please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))
示例#15
0
# -*- coding: utf-8 -*-

import os
import sys
import urlparse
from decimal import Decimal
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from livesettings import config_register, BooleanValue, StringValue, \
    ConfigurationGroup, PositiveIntegerValue, \
    DecimalValue

SHOP_GROUP = ConfigurationGroup('SHOP', _('Satchmo Shop Settings'), ordering=0)

project_root = os.path.dirname(
    os.path.normpath(
        sys.modules[os.environ['DJANGO_SETTINGS_MODULE']].__file__))
# default value `project_root + 'static'` is currently the best common for all Django 1.2 - 1.4
default_icon_url = urlparse.urlunsplit(
    ('file', '', os.path.join(project_root, 'static',
                              'images/sample-logo.bmp'), '', ''))

#### 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")),
示例#16
0
"""
Settings for reputation changes that apply to
user in response to various actions by the same
users or others
"""
from django.utils.translation import ugettext_lazy as _
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import REP_AND_BADGES
from livesettings import ConfigurationGroup, IntegerValue

REP_CHANGES = ConfigurationGroup(
    'REP_CHANGES',
    _('Karma loss and gain rules'),
    super_group=REP_AND_BADGES,
    ordering=2
)

settings.register(
    IntegerValue(
        REP_CHANGES,
        'MAX_REP_GAIN_PER_USER_PER_DAY',
        default=200,
        description=_('Maximum daily reputation gain per user')
    )
)

settings.register(
    IntegerValue(
        REP_CHANGES,
        'REP_GAIN_FOR_RECEIVING_UPVOTE',
        default=10,
示例#17
0
# -*- coding: utf-8 -*-

import os
import urlparse
from decimal import Decimal
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from livesettings import config_register, BooleanValue, StringValue, \
    MultipleStringValue, ConfigurationGroup, PositiveIntegerValue, \
    DecimalValue, config_get

BILLING_GROUP = ConfigurationGroup('BILLING',
                                   _('Billing Settings'),
                                   ordering=0)

SERVER_MODULES = config_get('SERVER', 'MODULES')
SERVER_MODULES.add_choice(('nibblebill', _('Billings')))
SERVER_MODULES.add_choice(('nibblebill', _('Billings')))

##SERVER_GROUP = ConfigurationGroup('xml_cdr',
##    _('CDR XML Module Settings'),
##    requires=SERVER_MODULES,
##    ordering = 104)

config_register(
    DecimalValue(
        BILLING_GROUP,
        'BALANCE_CASH',
        description=_('Beginning balance'),
        help_text=_(
            "The initial balance in the new user registration such as 0.25 USD"
示例#18
0
from livesettings import (ConfigurationGroup, config_register_list,
                          BooleanValue, ModuleValue, StringValue,
                          MultipleStringValue)
from django.utils.translation import ugettext_lazy as _

# 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,
示例#19
0
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')))
示例#20
0
"""
Q&A forum flatpages (about, etc.)
"""
from askbot.conf.settings_wrapper import settings
from livesettings import ConfigurationGroup, LongStringValue
from askbot.conf.super_groups import CONTENT_AND_UI
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat

FLATPAGES = ConfigurationGroup(
    'FLATPAGES',
    _('Messages and pages - about, privacy policy, etc.'),
    super_group=CONTENT_AND_UI,
)

settings.register(
    LongStringValue(
        FLATPAGES,
        'FORUM_ABOUT',
        description=_('Text of the Q&A forum About page (html format)'),
        localized=True,
        help_text=\
        _(
            'Save, then <a href="http://validator.w3.org/">'
            'use HTML validator</a> on the "about" page to check your input.'
        )
    )
)

settings.register(
    LongStringValue(
示例#21
0
文件: badges.py 项目: allieus/askbot3
"""
Settings for reputation changes that apply to
user in response to various actions by the same
users or others
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import REP_AND_BADGES
from livesettings import ConfigurationGroup
from livesettings import IntegerValue
from livesettings import BooleanValue
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat


BADGES = ConfigurationGroup('BADGES', _('Badge settings'), ordering=2, super_group=REP_AND_BADGES)


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]
示例#22
0
"""Settings to control content moderation"""

from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import DATA_AND_FORMATTING
from livesettings import ConfigurationGroup, BooleanValue, LongStringValue, StringValue
from django.utils.translation import ugettext_lazy as _

MODERATION = ConfigurationGroup(
                    'MODERATION',
                    _('Content moderation'),
                    super_group=DATA_AND_FORMATTING
                )

CONTENT_MODERATION_MODE_CHOICES = (
    ('flags', _('audit flagged posts')),
    ('audit', _('audit flagged posts and watched users')),
    ('premoderation', _('pre-moderate watched users and audit flagged posts')),
)

settings.register(
    StringValue(
        MODERATION,
        'CONTENT_MODERATION_MODE',
        choices=CONTENT_MODERATION_MODE_CHOICES,
        default='flags',
        description=_('Content moderation method'),
        help_text=_("Audit is made after the posts are published, pre-moderation prevents publishing before moderator's decision.")
    )
)

settings.register(
示例#23
0
        # is the same
        return new_value

    if new_value is True:
        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 "
示例#24
0
"""Settings for content moderation and spam control"""
from django.utils.translation import ugettext_lazy as _
from askbot import const
from askbot.conf.settings_wrapper import settings
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',
示例#25
0
#!/usr/bin/env python

from livesettings import config_register, BooleanValue, ConfigurationGroup, FloatValue, PositiveIntegerValue, StringValue
from django.utils.translation import ugettext_lazy as _

# Site domain settings
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.'),
示例#26
0
文件: config.py 项目: tcv1/satchmo
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))
示例#27
0
# -*- coding: utf-8 -*-
from decimal import Decimal
from livesettings import (config_register, ConfigurationGroup,
                                    StringValue, DecimalValue)
from django.utils.translation import ugettext_lazy as _


# ZONES_INFO configs
ZONES_INFO = ConfigurationGroup(
    'ZONES_INFO',
    _('Configurations for Zones'),
    ordering=0
)

# max_days
config_register(
    DecimalValue(
        ZONES_INFO,
        'MAX_DAYS',
        description=_('Max days for stale shipments'),
        help_text="",
        default=Decimal('1'),
    )
)
示例#28
0
"""
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')))
示例#29
0
"""
Forum configuration settings detailing rules on votes
and offensive flags.

For example number of times a person can vote each day, etc.
"""
from django.utils.translation import ugettext_lazy as _
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import REP_AND_BADGES
from livesettings import ConfigurationGroup, IntegerValue

VOTE_RULES = ConfigurationGroup('VOTE_RULES',
                                _('Vote and flag limits'),
                                ordering=1,
                                super_group=REP_AND_BADGES)

settings.register(
    IntegerValue(VOTE_RULES,
                 'MAX_VOTES_PER_USER_PER_DAY',
                 default=30,
                 description=_('Number of votes a user can cast per day')))

settings.register(
    IntegerValue(VOTE_RULES,
                 'MAX_FLAGS_PER_USER_PER_DAY',
                 default=5,
                 description=_('Maximum number of flags per user per day')))

settings.register(
    IntegerValue(
        VOTE_RULES,
示例#30
0
"""
Settings that modify processing of user text input
"""

from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import DATA_AND_FORMATTING
from livesettings import ConfigurationGroup
from livesettings import BooleanValue, StringValue, LongStringValue
from askbot import const
from django.utils.translation import ugettext_lazy as _
import re

MARKUP = ConfigurationGroup('MARKUP',
                            _('Markup in posts'),
                            super_group=DATA_AND_FORMATTING)


def regex_settings_validation(*args):
    """
    Validate the regular expressions
    """
    try:

        new_value = args[1]
        regex_list = new_value.split('\n')

        for i in range(0, len(regex_list)):
            re.compile(regex_list[i].strip())
        return args[1]

    except Exception: