Commit 1b612329 by bmedx

Fixes to celery queuing and text

parent 6ca739d8
"""
Receivers of signals sent from django-user-tasks
"""
import logging
from urlparse import urljoin
from django.core.urlresolvers import reverse
......@@ -42,4 +43,8 @@ def user_task_stopped_handler(sender, **kwargs): # pylint: disable=unused-argum
reverse('usertaskstatus-detail', args=[status.uuid])
)
send_task_complete_email.delay(status.name, status.state_text, status.user.email, detail_url)
try:
# Need to str state_text here because it is a proxy object and won't serialize correctly
send_task_complete_email.delay(status.name.lower(), str(status.state_text), status.user.email, detail_url)
except Exception as e: # pylint: disable=broad-except
logging.exception("Unable to queue send_task_complete_email")
......@@ -145,7 +145,7 @@ class TestUserTaskStopped(APITestCase):
platform_name=settings.PLATFORM_NAME, studio_name=settings.STUDIO_NAME
)
body_fragments = [
"Your {task_name} task has completed with the status".format(task_name=self.status.name),
"Your {task_name} task has completed with the status".format(task_name=self.status.name.lower()),
"https://test.edx.org/",
reverse('usertaskstatus-detail', args=[self.status.uuid])
]
......@@ -182,7 +182,7 @@ class TestUserTaskStopped(APITestCase):
platform_name=settings.PLATFORM_NAME, studio_name=settings.STUDIO_NAME
)
fragments = [
"Your {task_name} task has completed with the status".format(task_name=self.status.name),
"Your {task_name} task has completed with the status".format(task_name=self.status.name.lower()),
"Sign in to view the details of your task or download any files created."
]
......
......@@ -2,10 +2,10 @@
% if detail_url:
${_("Your {task_name} task has completed with the status {task_status}. Use this URL to view task details or download any files created: {detail_url}").format(task_name=task_name, task_status=task_status, detail_url=detail_url)}
${_("Your {task_name} task has completed with the status '{task_status}'. Use this URL to view task details or download any files created: {detail_url}").format(task_name=task_name, task_status=task_status, detail_url=detail_url)}
% else:
${_("Your {task_name} task has completed with the status {task_status}. Sign in to view the details of your task or download any files created.").format(task_name=task_name, task_status=task_status)}
${_("Your {task_name} task has completed with the status '{task_status}'. Sign in to view the details of your task or download any files created.").format(task_name=task_name, task_status=task_status)}
% endif
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