diff options
-rw-r--r-- | askbot/conf/settings_wrapper.py | 8 | ||||
-rw-r--r-- | askbot/conf/site_modes.py | 85 | ||||
-rw-r--r-- | askbot/doc/source/changelog.rst | 3 |
3 files changed, 59 insertions, 37 deletions
diff --git a/askbot/conf/settings_wrapper.py b/askbot/conf/settings_wrapper.py index aac8f071..2e0d8db2 100644 --- a/askbot/conf/settings_wrapper.py +++ b/askbot/conf/settings_wrapper.py @@ -49,6 +49,14 @@ class ConfigSettings(object): """ return getattr(self.__instance, key).value + def get_default(self, key): + """return the defalut value for the setting""" + return getattr(self.__instance, key).default + + def reset(self, key): + """returns setting to the default value""" + self.update(key, self.get_default(key)) + def update(self, key, value): setting = config_get(self.__group_map[key], key) setting.update(value) diff --git a/askbot/conf/site_modes.py b/askbot/conf/site_modes.py index 45aaec90..e79169e7 100644 --- a/askbot/conf/site_modes.py +++ b/askbot/conf/site_modes.py @@ -7,7 +7,37 @@ Site modes settings: from askbot.conf.settings_wrapper import settings from askbot.deps.livesettings import ConfigurationGroup, BooleanValue from django.utils.translation import ugettext as _ -from askbot.conf import badges, minimum_reputation + +BOOTSTRAP_MODE_SETTINGS = { + #minimum reputation settins. + 'MIN_REP_TO_VOTE_UP': 5, + 'MIN_REP_TO_VOTE_DOWN': 50, + 'MIN_REP_TO_ANSWER_OWN_QUESTION': 5, + 'MIN_REP_TO_ACCEPT_OWN_ANSWER': 20, + 'MIN_REP_TO_FLAG_OFFENSIVE': 5, + 'MIN_REP_TO_LEAVE_COMMENTS': 10, + 'MIN_REP_TO_DELETE_OTHERS_COMMENTS': 200, + 'MIN_REP_TO_DELETE_OTHERS_POSTS': 500, + 'MIN_REP_TO_UPLOAD_FILES': 10, + 'MIN_REP_TO_CLOSE_OWN_QUESTIONS': 25, + 'MIN_REP_TO_RETAG_OTHERS_QUESTIONS': 50, + 'MIN_REP_TO_REOPEN_OWN_QUESTIONS': 50, + 'MIN_REP_TO_EDIT_WIKI': 75, + 'MIN_REP_TO_EDIT_OTHERS_POSTS': 200, + 'MIN_REP_TO_VIEW_OFFENSIVE_FLAGS': 200, + 'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS': 200, + 'MIN_REP_TO_LOCK_POSTS': 400, + 'MIN_REP_TO_HAVE_STRONG_URL': 25, + #badge settings + 'NOTABLE_QUESTION_BADGE_MIN_VIEWS': 25, + 'POPULAR_QUESTION_BADGE_MIN_VIEWS': 15, + 'FAMOUS_QUESTION_BADGE_MIN_VIEWS': 50, + 'ENTHUSIAST_BADGE_MIN_DAYS': 5, + 'TAXONOMIST_BADGE_MIN_USE_COUNT': 5, + #moderation rule settings + 'MIN_FLAGS_TO_HIDE_POST': 2, + 'MIN_FLAGS_TO_DELETE_POST': 3, +} def bootstrap_callback(current_value, new_value): '''Callback to update settings''' @@ -18,46 +48,19 @@ def bootstrap_callback(current_value, new_value): 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, value in BOOTSTRAP_MODE_SETTINGS.items(): + settings.update(key, value) - for key in minimum_reputation.MIN_REP.keys(): - default_value = minimum_reputation.MIN_REP[key].default - settings.update(key, default_value) + else: + for key in BOOTSTRAP_MODE_SETTINGS: + settings.reset(key) return new_value SITE_MODES = ConfigurationGroup( 'SITE_MODES', - _('Reputation & limits mode'), + _('Site modes'), ) settings.register( @@ -65,8 +68,18 @@ settings.register( SITE_MODES, 'ACTIVATE_BOOTSTRAP_MODE', default=False, - description=_('Check this value to activate a special "Bootstrap" mode'), - help_text=_("<strong>WARNING:</strong> your current value for Minimum reputation and Bagde Settings will be changed after you save.."), + description=_( + 'Activate a "Bootstrap" mode'), + help_text=_( + "Bootstrap mode lowers reputation and certain badge " + "thresholds, to values, more suitable " + "for the smaller communities, " + "<strong>WARNING:</strong> your current value for " + "Minimum reputation, " + "Bagde Settings and " + "Vote Rules will " + "be changed after you modify this setting." + ), update_callback = bootstrap_callback ) ) diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index dd1488a0..0592cc54 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -4,8 +4,9 @@ Changes in Askbot Development version (Not yet released) -------------------------------------- * RSS feed for individual question (Sayan Chowdhury) -* Allow pre-population of tags via ask a questios link (Adolfo) +* Allow pre-population of tags via ask a questions link (Adolfo) * Make answering own question one click harder (Adolfo) +* Bootstrap mode (Adolfo, Evgeny) 0.7.24 (Current Version) ------------------------ |