示例#1
0
def bootstrap_callback(current_value, new_value):
    if current_value == new_value:
        return new_value
    if new_value:
        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
示例#2
0
def bootstrap_callback(current_value, new_value):
    '''Callback to update settings'''

    if current_value == new_value:
        # Do not overwrite settings in case that tha value is the same
        return new_value

    if new_value:
        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
示例#3
0
def bootstrap_callback(current_value, new_value):
    '''Callback to update settings'''

    if current_value == new_value:
        # Do not overwrite settings in case that tha value is the same
        return new_value

    if new_value:
        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
示例#4
0
def enable_default_selector_if_disabled(old_value, new_value):
    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
示例#5
0
def update_email_callback(old, new):
    if new.strip():
        settings.update('BLACKLISTED_EMAIL_PATTERNS_MODE', 'disabled')
    return new
示例#6
0
def enable_ldap_callback(current_value, new_value):
    """enables local login form when ldap is on"""
    if new_value == True:
        settings.update("SIGNIN_LOCAL_ENABLED", True)

    return new_value
def update_email_callback(old, new):
    if new.strip():
        settings.update('BLACKLISTED_EMAIL_PATTERNS_MODE', 'disabled')
    return new
示例#8
0
def enable_default_selector_if_disabled(old_value, new_value):
    scope_switch_name = new_value.upper() + '_SCOPE_ENABLED'
    is_enabled = getattr(settings, scope_switch_name)
    if not is_enabled:
        settings.update(scope_switch_name, True)
    return new_value
示例#9
0
def bootstrap_callback(current_value, new_value):
    '''Callback to update settings'''

    if current_value == new_value:
        #do not overwrite settings in case that tha value 
        #is the same
        return new_value

    if new_value == True:
        #minimum reputation settgins.
        settings.update('MIN_REP_TO_VOTE_UP', 5)
        settings.update('MIN_REP_TO_VOTE_DOWN', 50)
        settings.update('MIN_REP_TO_ANSWER_OWN_QUESTION', 5)
        settings.update('MIN_REP_TO_ACCEPT_OWN_ANSWER', 20)
        settings.update('MIN_REP_TO_FLAG_OFFENSIVE', 5)
        settings.update('MIN_REP_TO_LEAVE_COMMENTS', 10)
        settings.update('MIN_REP_TO_DELETE_OTHERS_COMMENTS', 200)
        settings.update('MIN_REP_TO_DELETE_OTHERS_POSTS', 500)
        settings.update('MIN_REP_TO_UPLOAD_FILES', 10)
        settings.update('MIN_REP_TO_CLOSE_OWN_QUESTIONS', 25)
        settings.update('MIN_REP_TO_RETAG_OTHERS_QUESTIONS', 50)
        settings.update('MIN_REP_TO_REOPEN_OWN_QUESTIONS', 50)
        settings.update('MIN_REP_TO_EDIT_WIKI', 75)
        settings.update('MIN_REP_TO_EDIT_OTHERS_POSTS', 200)
        settings.update('MIN_REP_TO_VIEW_OFFENSIVE_FLAGS', 200)
        settings.update('MIN_REP_TO_CLOSE_OTHERS_QUESTIONS', 200)
        settings.update('MIN_REP_TO_LOCK_POSTS', 400)
        settings.update('MIN_REP_TO_HAVE_STRONG_URL', 25)
        #badge settings
        settings.update('NOTABLE_QUESTION_BADGE_MIN_VIEWS', 25)
        settings.update('POPULAR_QUESTION_BADGE_MIN_VIEWS', 15)
        settings.update('FAMOUS_QUESTION_BADGE_MIN_VIEWS', 50)
        settings.update('ENTHUSIAST_BADGE_MIN_DAYS', 5)
        settings.update('TAXONOMIST_BADGE_MIN_USE_COUNT', 5)
    else:
        for key in badges.BADGES.keys():
            default_value = badges.BADGES[key].default
            settings.update(key, default_value)

        for key in minimum_reputation.MIN_REP.keys():
            default_value = minimum_reputation.MIN_REP[key].default
            settings.update(key, default_value)

    return new_value