add catch for tasks AlreadyRunning

This commit is contained in:
Miles Steele
2013-07-22 13:17:59 -04:00
parent 8e923deca0
commit 02b7757d1b

View File

@@ -25,6 +25,7 @@ from django_comment_common.models import (Role,
from courseware.models import StudentModule
import instructor_task.api
from instructor_task.api_helper import AlreadyRunningError
import instructor.enrollment as enrollment
from instructor.enrollment import enroll_email, unenroll_email
import instructor.access as access
@@ -45,6 +46,8 @@ def common_exceptions_400(func):
return func(*args, **kwargs)
except User.DoesNotExist:
return HttpResponseBadRequest("User does not exist.")
except AlreadyRunningError:
return HttpResponseBadRequest("Task already running.")
return wrapped