Files
edx-platform/lms/djangoapps/django_comment_client/middleware.py
Calen Pennington cfae1cdf62 Pep8 autofixes
2013-02-06 11:13:50 -05:00

11 lines
358 B
Python

from comment_client import CommentClientError
from django_comment_client.utils import JsonError
import json
class AjaxExceptionMiddleware(object):
def process_exception(self, request, exception):
if isinstance(exception, CommentClientError) and request.is_ajax():
return JsonError(json.loads(exception.message))
return None