Django 1.7 compatibility: miscellaneous changes

(imported from commit 1f63d936c3d195acd033bb42fddacd240af3889b)
This commit is contained in:
Reid Barton 2015-08-18 18:41:11 -07:00
parent 599742536b
commit 9ded218950
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ def json_response(res_type="success", msg="", data={}, status=200):
content = {"result": res_type, "msg": msg}
content.update(data)
return HttpResponse(content=ujson.dumps(content) + "\n",
mimetype='application/json', status=status)
content_type='application/json', status=status)
def json_success(data={}):
return json_response(data=data)

View File

@ -144,7 +144,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
def get(self):
from tornado.wsgi import WSGIContainer
from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.wsgi import WSGIRequest, get_script_name
import urllib
environ = WSGIContainer.environ(self.request)
@ -152,7 +152,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):
request = WSGIRequest(environ)
request._tornado_handler = self
set_script_prefix(base.get_script_name(environ))
set_script_prefix(get_script_name(environ))
signals.request_started.send(sender=self.__class__)
try:
response = self.get_response(request)