openmedialibrary_platform/Shared/lib/python3.4/site-packages/ox/django/middleware.py

16 lines
512 B
Python
Raw Normal View History

2013-10-11 17:28:32 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
2015-11-04 12:01:55 +00:00
from .shortcuts import HttpErrorJson, render_to_json_response
2013-10-11 17:28:32 +00:00
class ExceptionMiddleware(object):
def process_exception(self, request, exception):
if isinstance(exception, HttpErrorJson):
return render_to_json_response(exception.response)
return None
class ChromeFrameMiddleware(object):
def process_response(self, request, response):
response['X-UA-Compatible'] = 'chrome=1'
return response