X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/1a949f7c97dc2f34c135f5cdf088df2927d3d652..99d077e46d0eb3efd5e96a65f120e6e4b6197db0:/forum/utils/decorators.py diff --git a/forum/utils/decorators.py b/forum/utils/decorators.py index e4e7acb..18a5826 100644 --- a/forum/utils/decorators.py +++ b/forum/utils/decorators.py @@ -1,13 +1,13 @@ +import json from django.http import HttpResponse, HttpResponseForbidden, Http404 -from django.utils import simplejson def ajax_login_required(view_func): def wrap(request,*args,**kwargs): if request.user.is_authenticated(): return view_func(request,*args,**kwargs) else: - json = simplejson.dumps({'login_required':True}) - return HttpResponseForbidden(json,mimetype='application/json') + json = json.dumps({'login_required':True}) + return HttpResponseForbidden(json, content_type='application/json') return wrap def ajax_method(view_func): @@ -16,10 +16,10 @@ def ajax_method(view_func): raise Http404 retval = view_func(request,*args,**kwargs) if isinstance(retval, HttpResponse): - retval.mimetype = 'application/json' + retval.content_type = 'application/json' return retval else: - json = simplejson.dumps(retval) - return HttpResponse(json,mimetype='application/json') + json = json.dumps(retval) + return HttpResponse(json, content_type='application/json') return wrap