예제 #1
0
 def test_export(self):
     "Details of exported settings"
     self.client.login(username='******', password='******')
     val2 = IntegerValue(BASE_GROUP, 'ModifiedItem', default=0)
     config_register(val2)
     val2.update(6789)
     response = self.client.get('/settings/export/')
     self.assertContains(response, "LIVESETTINGS_OPTIONS =", 1)
     self.assertContains(response, "'DB': False", 1)
     self.assertContains(response, "'BASE':", 1)
     self.assertContains(response, "'ModifiedItem': '6789'", 1)
예제 #2
0
    def setUp(self):
        # clear out cache from previous runs
        keyedcache.cache_delete()

        g1 = ConfigurationGroup('req1', 'Requirements 1', ordering=1000)

        self.g1 = g1

        bool1 = config_register(BooleanValue(g1, 'bool1', default=False, ordering=1))
        bool2 = config_register(BooleanValue(g1, 'bool2', ordering=2))

        self.g1c1 = config_register(IntegerValue(g1, 'c1', requires=bool1, ordering=3))

        self.g1c2 = config_register(IntegerValue(g1, 'c2', requires=bool2, ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, 'c3', ordering=5))

        bool2.update(True)
예제 #3
0
    def setUp(self):
        # clear out cache from previous runs
        keyedcache.cache_delete()

        g1 = ConfigurationGroup('reqval', 'Requirements 3', ordering=1000)

        self.g1 = g1

        choices1 = config_register(MultipleStringValue(BASE_GROUP, 'valchoices', ordering=1))

        self.g1c1 = config_register(IntegerValue(g1, 'c1', requires=choices1, requiresvalue='foo', ordering=3))
        self.g1c2 = config_register(IntegerValue(g1, 'c2', requires=choices1, requiresvalue='bar', ordering=4))
        self.g1c3 = config_register(IntegerValue(g1, 'c3', ordering=5))

        choices1.update('foo')

        g2 = ConfigurationGroup('reqval2', 'Requirements 4', ordering=1000)

        self.g2 = g2

        choices2 = config_register(StringValue(BASE_GROUP, 'valchoices2', ordering=1,
            choices=(('a', 'test a'), ('b', 'test b'), ('c', 'test c'))))

        self.g2c1 = config_register(IntegerValue(g2, 'c1', requires=choices2, requiresvalue='a', ordering=3))
        self.g2c2 = config_register(IntegerValue(g2, 'c2', requires=choices2, requiresvalue='b', ordering=4))
        self.g2c3 = config_register(IntegerValue(g2, 'c3', requires=choices2, requiresvalue='c', ordering=5))

        choices2.update('a')
예제 #4
0
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 list(params.items()):
        param_description = param_data[0]
        param_default = param_data[1]
        settings.register(
            IntegerValue(BADGES,
                         badge_slug + '_BADGE_' + param_slug,
                         description=format_lazy('{}: {}', badge_name,
                                                 param_description),
                         default=param_default))
예제 #5
0
For example number of times a person can vote each day, etc.
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import REP_AND_BADGES
from livesettings.values import ConfigurationGroup, IntegerValue
from django.utils.translation import ugettext_lazy as _

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,
        'VOTES_LEFT_WARNING_THRESHOLD',
        default=5,
        description=_('Threshold for warning about remaining daily votes')))
예제 #6
0
from livesettings.functions import config_register_list
from livesettings.values import ConfigurationGroup, 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))
예제 #7
0
# I am doing it this way instead of a boolean for email verification because I
# intend to add a "manual approval" style of account verification. -Bruce
ACCOUNT_VERIFICATION = config_register(
    StringValue(
        SHOP_GROUP,
        'ACCOUNT_VERIFICATION',
        description=_("Account Verification"),
        help_text=
        _("Select the style of account verification.  'Immediate' means no verification needed."
          ),
        default="IMMEDIATE",
        choices=[('IMMEDIATE', _('Immediate')), ('EMAIL', _('Email'))]))
config_register(
    BooleanValue(
        SHOP_GROUP,
        'ALLOW_NICKNAME_USERNAME',
        description=_("Nickname-Registration"),
        help_text=
        _("If checked a user will be able to fill in an individual Nickname-Username at Account-Registration"
          ),
        default=False))

config_register(
    IntegerValue(SHOP_GROUP,
                 'ACCOUNT_ACTIVATION_DAYS',
                 description=_('Days to verify account'),
                 default=7,
                 requires=ACCOUNT_VERIFICATION,
                 requiresvalue='EMAIL'))