middleware file forgot to include

This commit is contained in:
Rocky Duan
2012-07-30 17:17:09 -04:00
parent 941ae0f068
commit 8bf2eb17e8

View File

@@ -0,0 +1,9 @@
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