From: Attila-Mihaly Balazs Date: Thu, 16 Jan 2014 10:06:15 +0000 (+0200) Subject: Access request trough singleton where necessarry X-Git-Tag: live~28^2 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/a67c564e9a6b8779bd6f0ce694b56eaabb337dcb?ds=inline Access request trough singleton where necessarry --- diff --git a/forum/actions/node.py b/forum/actions/node.py index f9f2206..8a4760b 100644 --- a/forum/actions/node.py +++ b/forum/actions/node.py @@ -2,7 +2,7 @@ from django.utils.html import strip_tags from django.utils.translation import ugettext as _ from forum.models.action import ActionProxy from forum.models import Comment, Question, Answer, NodeRevision -import logging +from forum import settings, REQUEST_HOLDER from django.contrib import messages @@ -30,7 +30,7 @@ class AskAction(NodeEditAction): question.save() self.node = question - messages.info(request, self.describe(self.user)) + messages.info(REQUEST_HOLDER.request, self.describe(self.user)) def describe(self, viewer=None): return _("%(user)s asked %(question)s") % { @@ -49,7 +49,7 @@ class AnswerAction(NodeEditAction): def process_action(self): self.node.question.reset_answer_count_cache() - messages.info(request, self.describe(self.user)) + messages.info(REQUEST_HOLDER.request, self.describe(self.user)) def describe(self, viewer=None): diff --git a/forum/actions/user.py b/forum/actions/user.py index 3e1721b..5a6aba5 100644 --- a/forum/actions/user.py +++ b/forum/actions/user.py @@ -3,7 +3,7 @@ from django.core.urlresolvers import reverse from django.db.models import F from forum.models.action import ActionProxy from forum.models import Award, Badge, ValidationHash, User -from forum import settings +from forum import settings, REQUEST_HOLDER from forum.settings import APP_SHORT_NAME from forum.utils.mail import send_template_email @@ -78,7 +78,7 @@ class BonusRepAction(ActionProxy): message=_("Congratulations, you have been awarded an extra %s reputation points.") % self._value + '
%s' % self.extra.get('message', _('Thank you'))) else: - messages.info(request, _("You have penalized %s in %s reputation points.") % (self._affected, self._value) + + messages.info(REQUEST_HOLDER.request, _("You have penalized %s in %s reputation points.") % (self._affected, self._value) + '
%s' % self.extra.get('message', '')) def describe(self, viewer=None):