From bdc1f3f4e02e0d558bb80e70679d5e56172d32b9 Mon Sep 17 00:00:00 2001 From: hernani Date: Mon, 31 May 2010 21:35:26 +0000 Subject: [PATCH] Fixes some errors that showed up in the logs. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@347 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- .../default/templates/notifications/answeraccepted.html | 2 +- forum/subscriptions.py | 2 +- forum_modules/default_badges/badges.py | 2 +- forum_modules/pgfulltext/handlers.py | 6 ++++-- settings_local.py.dist | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/forum/skins/default/templates/notifications/answeraccepted.html b/forum/skins/default/templates/notifications/answeraccepted.html index bdbf79a..6c34040 100644 --- a/forum/skins/default/templates/notifications/answeraccepted.html +++ b/forum/skins/default/templates/notifications/answeraccepted.html @@ -3,7 +3,7 @@ {% load extra_tags %} {% block content %} - {% var accepted_by = answer.accepted.by.username %} + {% var accepted_by = answer.nstate.accepted.by.username %} {% var answer_author = answer.author.username %} {% var app_url = settings.APP_URL %} {% var question_url = question.get_absolute_url %} diff --git a/forum/subscriptions.py b/forum/subscriptions.py index 45f430f..1ee99e3 100644 --- a/forum/subscriptions.py +++ b/forum/subscriptions.py @@ -124,7 +124,7 @@ def answer_accepted(action, new): subscription_settings__enable_notifications=True, subscription_settings__notify_accepted=True, subscription_settings__subscribed_questions='i' - ).exclude(id=action.node.accepted.by.id).distinct() + ).exclude(id=action.node.nstate.accepted.by.id).distinct() recipients = create_recipients_dict(subscribers) send_email(settings.EMAIL_SUBJECT_PREFIX + _("An answer to '%(question_title)s' was accepted") % dict(question_title=question.title), diff --git a/forum_modules/default_badges/badges.py b/forum_modules/default_badges/badges.py index cb2ed2f..e84fcbf 100644 --- a/forum_modules/default_badges/badges.py +++ b/forum_modules/default_badges/badges.py @@ -226,7 +226,7 @@ class Pundit(AbstractBadge): description = _('Left %s comments') % settings.PUNDIT_COMMENT_COUNT def award_to(self, action): - if (action.user.nodes.filter(node_type="comment", deleted=None)) == int(settings.CIVIC_DUTY_VOTES): + if action.user.nodes.filter_state(deleted=False).filter(node_type="comment").count() == int(settings.CIVIC_DUTY_VOTES): return action.user diff --git a/forum_modules/pgfulltext/handlers.py b/forum_modules/pgfulltext/handlers.py index e46c571..c8b4e09 100644 --- a/forum_modules/pgfulltext/handlers.py +++ b/forum_modules/pgfulltext/handlers.py @@ -1,11 +1,13 @@ +import re from django.db.models import Q from forum.models.question import Question, QuestionManager from forum.modules.decorators import decorate @decorate(QuestionManager.search, needs_origin=False) def question_search(self, keywords): - tsquery = " | ".join([k for k in keywords.split(' ') if k]) - + repl_re = re.compile(r'[^\'-_\s\w]') + tsquery = " | ".join([k for k in repl_re.sub('', keywords).split(' ') if k]) + return self.extra( tables = ['forum_rootnode_doc'], select={ diff --git a/settings_local.py.dist b/settings_local.py.dist index 053032b..6d0e446 100644 --- a/settings_local.py.dist +++ b/settings_local.py.dist @@ -13,7 +13,7 @@ logging.basicConfig( ) #ADMINS and MANAGERS -ADMINS = (('Forum Admin', 'forum@example.com'),) +ADMINS = () MANAGERS = ADMINS DEBUG = False -- 2.39.5