Unverified Commit 14c1f5bd by Sofiya Semenova Committed by GitHub

Merge pull request #16616 from edx/sofiya/clean

Don't get the site object unless the message is going to be sent
parents b78d5061 e77137c2
...@@ -3,7 +3,6 @@ Defines asynchronous celery task for sending email notification (through edx-ace ...@@ -3,7 +3,6 @@ Defines asynchronous celery task for sending email notification (through edx-ace
pertaining to new discussion forum comments. pertaining to new discussion forum comments.
""" """
import logging import logging
from urllib import urlencode
from urlparse import urljoin from urlparse import urljoin
from celery import task from celery import task
...@@ -41,8 +40,9 @@ class ResponseNotification(MessageType): ...@@ -41,8 +40,9 @@ class ResponseNotification(MessageType):
@task(base=LoggedTask, routing_key=ROUTING_KEY) @task(base=LoggedTask, routing_key=ROUTING_KEY)
def send_ace_message(context): def send_ace_message(context):
context['course_id'] = CourseKey.from_string(context['course_id']) context['course_id'] = CourseKey.from_string(context['course_id'])
context['site'] = Site.objects.get(id=context['site_id'])
if _should_send_message(context): if _should_send_message(context):
context['site'] = Site.objects.get(id=context['site_id'])
thread_author = User.objects.get(id=context['thread_author_id']) thread_author = User.objects.get(id=context['thread_author_id'])
middleware_classes = [ middleware_classes = [
CurrentRequestUserMiddleware, CurrentRequestUserMiddleware,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment