add oxdjango to ox package
This commit is contained in:
parent
0eeecabbd2
commit
0262ae50ca
11 changed files with 355 additions and 4 deletions
15
ox/django/middleware.py
Normal file
15
ox/django/middleware.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
|
||||
from shortcuts import HttpErrorJson, render_to_json_response
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue