summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-05-08 00:42:08 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-05-08 00:42:08 -0400
commit2c2308ad323362ed6f8765e79c781412f6827157 (patch)
treeecfb59dc0eb8592b0173859527a2c96611d8485b
parentdbc9e355d821c380d4492ec878646bd46b8f0dfc (diff)
downloadaskbot-2c2308ad323362ed6f8765e79c781412f6827157.tar.gz
askbot-2c2308ad323362ed6f8765e79c781412f6827157.tar.bz2
askbot-2c2308ad323362ed6f8765e79c781412f6827157.zip
added vote rule and minimum rep settings
-rw-r--r--forum/auth.py152
-rw-r--r--forum/conf/__init__.py6
-rw-r--r--forum/conf/minimum_reputation.py148
-rw-r--r--forum/conf/settings_wrapper.py59
-rw-r--r--forum/conf/vote_rules.py69
-rw-r--r--forum/views/commands.py16
-rw-r--r--forum/views/readers.py1
-rw-r--r--forum/views/users.py3
-rw-r--r--forum/views/writers.py1
-rw-r--r--urls.py7
10 files changed, 320 insertions, 142 deletions
diff --git a/forum/auth.py b/forum/auth.py
index 3c1f20d0..4df7ea93 100644
--- a/forum/auth.py
+++ b/forum/auth.py
@@ -14,119 +14,8 @@ from models import mark_offensive, delete_post_or_answer
from const import TYPE_REPUTATION
import logging
-from forum.settings import AskbotConfigGroup
-
-from livesettings import BASE_GROUP, IntegerValue, IntegerValue, config_register
-from livesettings.values import SortedDotDict
-
-#todo: move this to forum.conf
-class ConfigSettings(object):
- """A very simple Singleton wrapper for settings
- a limitation is that all settings names using this class
- must be distinct, even though they might belong
- to different settings groups
- """
- __instance = None
-
- def __init__(self):
- """assigns SortedDotDict to self.__instance if not set"""
- if ConfigSettings.__instance == None:
- ConfigSettings.__instance = SortedDotDict()
- self.__dict__['_ConfigSettings__instance'] = ConfigSettings.__instance
-
- def __getattr__(self,key):
- """value lookup returns the actual value of setting
- not the object - this way only very minimal modifications
- will be required in code to convert an app
- depending on django.conf.settings to livesettings
- """
- return getattr(self.__instance, key).value
-
- def __setattr__(self, attr, value):
- """ settings crutch is read-only in the program """
- raise Exception('ConfigSettings cannot be changed programmatically')
-
- def register(self, value):
- """registers the setting
- value must be a subclass of livesettings.Value
- """
- key = value.key
- if key in self.__instance:
- raise Exception('setting %s is already registered' % key)
- else:
- self.__instance[key] = config_register(value)
-
-askbot_settings = ConfigSettings()
-
-askbot_settings.register(
- IntegerValue(
- BASE_GROUP,
- 'JUNK_VALUE',
- default=5,
- description=_('Some trash value')
- )
- )
-
-print 'junk value is ', askbot_settings.JUNK_VALUE
-
-MIN_REP = AskbotConfigGroup(
- 'MIN_REP',
- _('Minimum reputation settings'),
- ordering=0
- )
-
-VOTE_UP = MIN_REP.new_int_setting('VOTE_UP', 15, _('Vote'))
-
-print 'VOTE_UP=',VOTE_UP.value
-
-FLAG_OFFENSIVE = MIN_REP.new_int_setting('FLAG_OFFENSIVE', 15, _('Flag offensive'))
-
-LEAVE_COMMENTS = MIN_REP.new_int_setting('LEAVE_COMMENTS', 50, _('Leave comments'))
-
-UPLOAD_FILES = MIN_REP.new_int_setting('UPLOAD_FILES', 0, _('Upload files'))
-
-VOTE_DOWN = MIN_REP.new_int_setting('VOTE_DOWN', 0, _('Downvote'))
-
-CLOSE_OWN_QUESTIONS = MIN_REP.new_int_setting('CLOSE_OWN_QUESTIONS', 0, _('Close own questions'))
-
-RETAG_OTHER_QUESTIONS = MIN_REP.new_int_setting('RETAG_OTHER_QUESTIONS', 0, _('Retag questions posted by other people'))
-
-REOPEN_OWN_QUESTIONS = MIN_REP.new_int_setting('REOPEN_OWN_QUESTIONS', 0, _('Reopen own questions'))
-
-EDIT_COMMUNITY_WIKI_POSTS = MIN_REP.new_int_setting('EDIT_COMMUNITY_WIKI_POSTS', 0, _('Edit community wiki posts'))
-
-EDIT_OTHER_POSTS = MIN_REP.new_int_setting('EDIT_OTHER_POSTS', 0, _('Edit posts authored by other people'))
-
-DELETE_COMMENTS = MIN_REP.new_int_setting('DELETE_COMMENTS', 0, _('Delete comments'))
-
-VIEW_OFFENSIVE_FLAGS = MIN_REP.new_int_setting('VIEW_OFFENSIVE_FLAGS', 0, _('View offensive flags'))
-
-DISABLE_URL_NOFOLLOW = MIN_REP.new_int_setting('DISABLE_URL_NOFOLLOW', 0, _('Disable url nofollow'))
-
-CLOSE_OTHER_QUESTIONS = MIN_REP.new_int_setting('CLOSE_OTHER_QUESTIONS', 0, _('Close questions asked by others'))
-
-LOCK_POSTS = MIN_REP.new_int_setting('LOCK_POSTS', 0, _('Lock posts'))
-
-VOTE_RULE_SETTINGS = AskbotConfigGroup(
- 'VOTE_RULES',
- _('Vote and flag rules'),
- ordering=1)
-
-scope_votes_per_user_per_day = VOTE_RULE_SETTINGS.new_int_setting('scope_votes_per_user_per_day', 0, _('Maximum votes per day'))
-scope_flags_per_user_per_day = VOTE_RULE_SETTINGS.new_int_setting('scope_flags_per_user_per_day', 5, _('Maximum flags per day'))
-scope_warn_votes_left = VOTE_RULE_SETTINGS.new_int_setting('scope_warn_votes_left', 5, _('How early to start warning about the vote per day limit'))
-scope_deny_unvote_days = VOTE_RULE_SETTINGS.new_int_setting('scope_deny_unvote_days', 1, _('Days to allow canceling votes'))
-scope_flags_invisible_main_page = VOTE_RULE_SETTINGS.new_int_setting('scope_flags_invisible_main_page', 3, _('Number of flags to hide post'))
-scope_flags_delete_post = VOTE_RULE_SETTINGS.new_int_setting('scope_flags_delete_post', 5, _('Number of flags to delete post'))
-
-VOTE_RULES = {
- 'scope_votes_per_user_per_day' : scope_votes_per_user_per_day,
- 'scope_flags_per_user_per_day' : scope_flags_per_user_per_day,
- 'scope_warn_votes_left' : scope_warn_votes_left,
- 'scope_deny_unvote_days' : scope_deny_unvote_days,
- 'scope_flags_invisible_main_page' : scope_flags_invisible_main_page,
- 'scope_flags_delete_post' : scope_flags_delete_post,
-}
+from forum.conf import settings
+from forum.conf import AskbotConfigGroup
REP_RULE_SETTINGS = AskbotConfigGroup(
'REP_RULES',
@@ -248,13 +137,13 @@ def can_moderate_users(user):
def can_vote_up(user):
"""Determines if a User can vote Questions and Answers up."""
return user.is_authenticated() and (
- user.reputation >= VOTE_UP.value or
+ user.reputation >= settings.MIN_REP_TO_VOTE_UP or
user.is_superuser)
def can_flag_offensive(user):
"""Determines if a User can flag Questions and Answers as offensive."""
return user.is_authenticated() and (
- user.reputation >= FLAG_OFFENSIVE.value or
+ user.reputation >= settings.MIN_REP_TO_FLAG_OFFENSIVE or
user.is_superuser)
def can_add_comments(user,subject):
@@ -262,7 +151,7 @@ def can_add_comments(user,subject):
if user.is_authenticated():
if user.id == subject.author.id:
return True
- if user.reputation >= LEAVE_COMMENTS.value:
+ if user.reputation >= settings.MIN_REP_TO_LEAVE_COMMENTS:
return True
if user.is_superuser:
return True
@@ -273,53 +162,55 @@ def can_add_comments(user,subject):
def can_vote_down(user):
"""Determines if a User can vote Questions and Answers down."""
return user.is_authenticated() and (
- user.reputation >= VOTE_DOWN.value or
+ user.reputation >= settings.MIN_REP_TO_VOTE_DOWN or
user.is_superuser)
def can_retag_questions(user):
"""Determines if a User can retag Questions."""
return user.is_authenticated() and (
- RETAG_OTHER_QUESTIONS.value <= user.reputation < EDIT_OTHER_POSTS.value or
+ settings.MIN_REP_TO_RETAG_OTHERS_QUESTIONS
+ <= user.reputation
+ < settings.MIN_REP_TO_EDIT_OTHERS_POSTS or
user.is_superuser)
def can_edit_post(user, post):
"""Determines if a User can edit the given Question or Answer."""
return user.is_authenticated() and (
user.id == post.author_id or
- (post.wiki and user.reputation >= EDIT_COMMUNITY_WIKI_POSTS.value) or
- user.reputation >= EDIT_OTHER_POSTS.value or
+ (post.wiki and user.reputation >= settings.MIN_REP_TO_EDIT_WIKI) or
+ user.reputation >= settings.MIN_REP_TO_EDIT_OTHERS_POSTS or
user.is_superuser)
def can_delete_comment(user, comment):
"""Determines if a User can delete the given Comment."""
return user.is_authenticated() and (
user.id == comment.user_id or
- user.reputation >= DELETE_COMMENTS.value or
+ user.reputation >= settings.MIN_REP_TO_DELETE_OTHERS_COMMENTS or
user.is_superuser)
def can_view_offensive_flags(user):
"""Determines if a User can view offensive flag counts."""
return user.is_authenticated() and (
- user.reputation >= VIEW_OFFENSIVE_FLAGS.value or
+ user.reputation >= settings.MIN_REP_TO_VIEW_OFFENSIVE_FLAGS or
user.is_superuser)
def can_close_question(user, question):
"""Determines if a User can close the given Question."""
return user.is_authenticated() and (
(user.id == question.author_id and
- user.reputation >= CLOSE_OWN_QUESTIONS.value) or
- user.reputation >= CLOSE_OTHER_QUESTIONS.value or
+ user.reputation >= settings.MIN_REP_TO_CLOSE_OWN_QUESTIONS) or
+ user.reputation >= settings.MIN_REP_TO_CLOSE_OTHERS_QUESTIONS or
user.is_superuser)
def can_lock_posts(user):
"""Determines if a User can lock Questions or Answers."""
return user.is_authenticated() and (
- user.reputation >= LOCK_POSTS.value or
+ user.reputation >= settings.MIN_REP_TO_LOCK_POSTS or
user.is_superuser)
def can_follow_url(user):
"""Determines if the URL link can be followed by Google search engine."""
- return user.reputation >= DISABLE_URL_NOFOLLOW.value
+ return user.reputation >= settings.MIN_REP_TO_DISABLE_URL_NOFOLLOW
def can_accept_answer(user, question, answer):
return (user.is_authenticated() and
@@ -330,7 +221,7 @@ def can_accept_answer(user, question, answer):
def can_reopen_question(user, question):
return (user.is_authenticated() and
user.id == question.author_id and
- user.reputation >= REOPEN_OWN_QUESTIONS.value) or user.is_superuser
+ user.reputation >= settings.MIN_REP_TO_REOPEN_OWN_QUESTIONS) or user.is_superuser
def can_delete_post(user, post):
if user.is_superuser:
@@ -366,7 +257,8 @@ def can_view_user_edit(request_user, target_user):
return (request_user.is_authenticated() and request_user == target_user)
def can_upload_files(request_user):
- return (request_user.is_authenticated() and request_user.reputation >= UPLOAD_FILES.value) or \
+ return (request_user.is_authenticated() and
+ request_user.reputation >= settings.MIN_REP_TO_UPLOAD_FILES) or \
request_user.is_superuser
###########################################
@@ -404,7 +296,7 @@ def onFlaggedItem(item, post, user, timestamp=None):
reputation.save()
#todo: These should be updated to work on same revisions.
- if post.offensive_flag_count == VOTE_RULES['scope_flags_invisible_main_page'].value :
+ if post.offensive_flag_count == settings.MIN_FLAGS_TO_HIDE_POST:
post.author.reputation = calculate_reputation(post.author.reputation,
int(REPUTATION_RULES['lose_by_flagged_lastrevision_3_times'].value))
post.author.save()
@@ -417,7 +309,7 @@ def onFlaggedItem(item, post, user, timestamp=None):
reputation=post.author.reputation)
reputation.save()
- elif post.offensive_flag_count == VOTE_RULES['scope_flags_delete_post'].value :
+ elif post.offensive_flag_count == settings.MIN_FLAGS_TO_DELETE_POST:
post.author.reputation = calculate_reputation(post.author.reputation,
int(REPUTATION_RULES['lose_by_flagged_lastrevision_5_times'].value))
post.author.save()
diff --git a/forum/conf/__init__.py b/forum/conf/__init__.py
index 4147be8c..028f430a 100644
--- a/forum/conf/__init__.py
+++ b/forum/conf/__init__.py
@@ -1,5 +1,5 @@
import os
-from livesettings import ConfigurationGroup, IntegerValue, config_register
+from livesettings import ConfigurationGroup, IntegerValue, config_register, SortedDotDict
INSTALLED_APPS = ['forum']
@@ -64,3 +64,7 @@ class AskbotConfigGroup(ConfigurationGroup):
)
)
return setting
+
+import forum.conf.minimum_reputation
+import forum.conf.vote_rules
+from forum.conf.settings_wrapper import settings
diff --git a/forum/conf/minimum_reputation.py b/forum/conf/minimum_reputation.py
new file mode 100644
index 00000000..a83d94fd
--- /dev/null
+++ b/forum/conf/minimum_reputation.py
@@ -0,0 +1,148 @@
+"""
+Settings for minimum reputation required for
+a variety of actions on the askbot forum
+"""
+from forum.conf.settings_wrapper import settings
+from livesettings import ConfigurationGroup, IntegerValue
+from django.utils.translation import ugettext as _
+
+MIN_REP = ConfigurationGroup(
+ 'MIN_REP',
+ _('Minimum reputation required to perform actions'),
+ ordering=0
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_VOTE_UP',
+ default=15,
+ description=_('Upvote')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_VOTE_DOWN',
+ default=100,
+ description=_('Downvote')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_FLAG_OFFENSIVE',
+ default=15,
+ description=_('Flag offensive')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_LEAVE_COMMENTS',
+ default=50,
+ description=_('Leave comments')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_DELETE_OTHERS_COMMENTS',
+ default=2000,
+ description=_('Delete comments posted by others')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_UPLOAD_FILES',
+ default=60,
+ description=_('Upload files')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_CLOSE_OWN_QUESTIONS',
+ default=250,
+ description=_('Close own questions'),
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_RETAG_OTHERS_QUESTIONS',
+ default=500,
+ description=_('Retag questions posted by other people')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_REOPEN_OWN_QUESTIONS',
+ default=500,
+ description=_('Reopen own questions')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_EDIT_WIKI',
+ default=750,
+ description=_('Edit community wiki posts')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_EDIT_OTHERS_POSTS',
+ default=2000,
+ description=_('Edit posts authored by other people')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_VIEW_OFFENSIVE_FLAGS',
+ default=2000,
+ description=_('View offensive flags')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_DISABLE_URL_NOFOLLOW',
+ default=2000,
+ description=_('Disable nofollow directive on links')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS',
+ default=2000,
+ description=_('Close questions asked by others')
+ )
+ )
+
+settings.register(
+ IntegerValue(
+ MIN_REP,
+ 'MIN_REP_TO_LOCK_POSTS',
+ default=4000,
+ description=_('Lock posts')
+ )
+ )
diff --git a/forum/conf/settings_wrapper.py b/forum/conf/settings_wrapper.py
new file mode 100644
index 00000000..abf49e5f
--- /dev/null
+++ b/forum/conf/settings_wrapper.py
@@ -0,0 +1,59 @@
+"""
+Definition of a Singleton wrapper class for livesettings
+with interface similar to django.conf.settings
+that is each setting has unique key and is accessible
+via dotted lookup.
+
+for example to lookup value of setting BLAH you would do
+
+from forum.conf import settings
+
+settings.BLAH
+
+the value will be taken from livesettings database or cache
+note that during compilation phase database is not accessible
+for the most part, so actual values are reliably available only
+at run time
+
+livesettings is a module developed for satchmo project
+"""
+from livesettings import SortedDotDict, config_register
+
+class ConfigSettings(object):
+ """A very simple Singleton wrapper for settings
+ a limitation is that all settings names using this class
+ must be distinct, even though they might belong
+ to different settings groups
+ """
+ __instance = None
+
+ def __init__(self):
+ """assigns SortedDotDict to self.__instance if not set"""
+ if ConfigSettings.__instance == None:
+ ConfigSettings.__instance = SortedDotDict()
+ self.__dict__['_ConfigSettings__instance'] = ConfigSettings.__instance
+
+ def __getattr__(self, key):
+ """value lookup returns the actual value of setting
+ not the object - this way only very minimal modifications
+ will be required in code to convert an app
+ depending on django.conf.settings to livesettings
+ """
+ return getattr(self.__instance, key).value
+
+ def __setattr__(self, attr, value):
+ """ settings crutch is read-only in the program """
+ raise Exception('ConfigSettings cannot be changed programmatically')
+
+ def register(self, value):
+ """registers the setting
+ value must be a subclass of livesettings.Value
+ """
+ key = value.key
+ if key in self.__instance:
+ raise Exception('setting %s is already registered' % key)
+ else:
+ self.__instance[key] = config_register(value)
+
+#settings instance to be used elsewhere in the project
+settings = ConfigSettings()
diff --git a/forum/conf/vote_rules.py b/forum/conf/vote_rules.py
new file mode 100644
index 00000000..f249ef53
--- /dev/null
+++ b/forum/conf/vote_rules.py
@@ -0,0 +1,69 @@
+"""
+Forum configuration settings detailing rules on votes
+and offensive flags.
+
+For example number of times a person can vote each day, etc.
+"""
+from forum.conf.settings_wrapper import settings
+from livesettings import ConfigurationGroup, IntegerValue
+from django.utils.translation import ugettext as _
+
+VOTE_RULES = ConfigurationGroup(
+ 'VOTE_RULES',
+ _('Limits applicable to votes and moderation flags'),
+ ordering=1,
+ )
+
+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')
+ )
+)
+
+settings.register(
+ IntegerValue(
+ VOTE_RULES,
+ 'MAX_DAYS_TO_CANCEL_VOTE',
+ default=1,
+ description=_('Number of days to allow canceling votes')
+ )
+)
+
+settings.register(
+ IntegerValue(
+ VOTE_RULES,
+ 'MIN_FLAGS_TO_HIDE_POST',
+ default=3,
+ description=_('Number of flags required to automatically hide posts')
+ )
+)
+
+settings.register(
+ IntegerValue(
+ VOTE_RULES,
+ 'MIN_FLAGS_TO_DELETE_POST',
+ default=5,
+ description=_('Number of flags required to automatically delete posts')
+ )
+)
diff --git a/forum/views/commands.py b/forum/views/commands.py
index b5dbec56..2905426c 100644
--- a/forum/views/commands.py
+++ b/forum/views/commands.py
@@ -1,5 +1,7 @@
import datetime
+#todo: maybe eliminate usage of django.settings
from django.conf import settings
+from forum.conf import settings as forum_settings
from django.utils import simplejson
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
@@ -138,7 +140,8 @@ def vote(request, id):#todo: pretty incomprehensible view used by various ajax c
vote = post.votes.filter(user=request.user)[0]
# get latest vote by the current user
# unvote should be less than certain time
- if (datetime.datetime.now().day - vote.voted_at.day) >= auth.VOTE_RULES['scope_deny_unvote_days'].value:
+ if (datetime.datetime.now().day - vote.voted_at.day) \
+ >= forum_settings.MAX_DAYS_TO_CANCEL_VOTE:
response_data['status'] = 2
else:
voted = vote.vote
@@ -152,7 +155,8 @@ def vote(request, id):#todo: pretty incomprehensible view used by various ajax c
response_data['status'] = 1
response_data['count'] = post.score
- elif Vote.objects.get_votes_count_today_from_user(request.user) >= auth.VOTE_RULES['scope_votes_per_user_per_day'].value:
+ elif Vote.objects.get_votes_count_today_from_user(request.user)\
+ >= forum_settings.MAX_VOTES_PER_USER_PER_DAY:
response_data['allowed'] = -3
else:
vote = Vote(user=request.user, content_object=post, vote=vote_score, voted_at=datetime.datetime.now())
@@ -163,8 +167,10 @@ def vote(request, id):#todo: pretty incomprehensible view used by various ajax c
# downvote
auth.onDownVoted(vote, post, request.user)
- votes_left = auth.VOTE_RULES['scope_votes_per_user_per_day'].value - Vote.objects.get_votes_count_today_from_user(request.user)
- if votes_left <= auth.VOTE_RULES['scope_warn_votes_left'].value:
+ votes_left = forum_settings.MAX_VOTES_PER_USER_PER_DAY \
+ - Vote.objects.get_votes_count_today_from_user(request.user)
+ if votes_left <= \
+ forum_settings.VOTES_LEFT_WARNING_THRESHOLD:
response_data['message'] = u'%s votes left' % votes_left
response_data['count'] = post.score
elif vote_type in ['7', '8']:
@@ -174,7 +180,7 @@ def vote(request, id):#todo: pretty incomprehensible view used by various ajax c
post_id = request.POST.get('postId')
post = get_object_or_404(Answer, id=post_id)
- if FlaggedItem.objects.get_flagged_items_count_today(request.user) >= auth.VOTE_RULES['scope_flags_per_user_per_day'].value:
+ if FlaggedItem.objects.get_flagged_items_count_today(request.user) >= forum_settings.MAX_FLAGS_PER_USER_PER_DAY:
response_data['allowed'] = -3
elif not auth.can_flag_offensive(request.user):
response_data['allowed'] = -2
diff --git a/forum/views/readers.py b/forum/views/readers.py
index 338da62b..cd5522aa 100644
--- a/forum/views/readers.py
+++ b/forum/views/readers.py
@@ -21,7 +21,6 @@ from markdown2 import Markdown
from forum.utils.diff import textDiff as htmldiff
from forum.forms import *
from forum.models import *
-from forum.auth import *
from forum.const import *
from forum import const
from forum import auth
diff --git a/forum/views/users.py b/forum/views/users.py
index 5fb97ef9..a8b9398d 100644
--- a/forum/views/users.py
+++ b/forum/views/users.py
@@ -19,6 +19,7 @@ from django.contrib.contenttypes.models import ContentType
from forum.models import user_updated
from forum.const import USERS_PAGE_SIZE
from django.conf import settings
+from forum.conf import settings as forum_settings
question_type = ContentType.objects.get_for_model(Question)
answer_type = ContentType.objects.get_for_model(Answer)
@@ -218,7 +219,7 @@ def user_stats(request, user_id, user_view):
up_votes = Vote.objects.get_up_vote_count_from_user(user)
down_votes = Vote.objects.get_down_vote_count_from_user(user)
votes_today = Vote.objects.get_votes_count_today_from_user(user)
- votes_total = auth.VOTE_RULES['scope_votes_per_user_per_day'].value
+ votes_total = forum_settings.MAX_VOTES_PER_USER_PER_DAY
question_id_set = set(map(lambda v: v['id'], list(questions))) \
| set(map(lambda v: v['id'], list(answered_questions)))
diff --git a/forum/views/writers.py b/forum/views/writers.py
index 86831ba3..eddf2a87 100644
--- a/forum/views/writers.py
+++ b/forum/views/writers.py
@@ -15,7 +15,6 @@ from django.core.exceptions import PermissionDenied
from forum.forms import *
from forum.models import *
-from forum.auth import *
from forum.const import *
from forum import auth
from forum.utils.forms import get_next_url
diff --git a/urls.py b/urls.py
index 4fb65435..8c349456 100644
--- a/urls.py
+++ b/urls.py
@@ -1,7 +1,8 @@
-from django.conf.urls.defaults import *
-from django.utils.translation import ugettext as _
+"""
+main url configuration file for the askbot site
+"""
+from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
-import livesettings
from django.contrib import admin
admin.autodiscover()