From 66850026ca934e5a09238e9033c541cdc5085a42 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 13 Jan 2013 22:34:33 -0600 Subject: Use content_type and not mimetype on HttpResponse() Bug #16519 in Django deprecates mimetype, so update our code accordingly. Signed-off-by: Dan McGee --- packages/views/__init__.py | 4 ++-- packages/views/display.py | 4 ++-- packages/views/search.py | 2 +- packages/views/signoff.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'packages') diff --git a/packages/views/__init__.py b/packages/views/__init__.py index f795225..4c19538 100644 --- a/packages/views/__init__.py +++ b/packages/views/__init__.py @@ -42,7 +42,7 @@ def opensearch(request): def opensearch_suggest(request): search_term = request.GET.get('q', '') if search_term == '': - return HttpResponse('', mimetype='application/x-suggestions+json') + return HttpResponse('', content_type='application/x-suggestions+json') cache_key = 'opensearch:packages:' + \ hashlib.md5(search_term.encode('utf-8')).hexdigest() @@ -59,7 +59,7 @@ def opensearch_suggest(request): results = [search_term, list(names)] to_json = json.dumps(results, ensure_ascii=False) cache.set(cache_key, to_json, 300) - return HttpResponse(to_json, mimetype='application/x-suggestions+json') + return HttpResponse(to_json, content_type='application/x-suggestions+json') @permission_required('main.change_package') diff --git a/packages/views/display.py b/packages/views/display.py index efedf6f..445c1ab 100644 --- a/packages/views/display.py +++ b/packages/views/display.py @@ -188,7 +188,7 @@ def details_json(request, name, repo, arch): pkg = get_object_or_404(Package, pkgname=name, repo__name__iexact=repo, arch__name=arch) to_json = json.dumps(pkg, ensure_ascii=False, cls=PackageJSONEncoder) - return HttpResponse(to_json, mimetype='application/json') + return HttpResponse(to_json, content_type='application/json') def files_json(request, name, repo, arch): @@ -209,7 +209,7 @@ def files_json(request, name, repo, arch): 'files': fileslist, } to_json = json.dumps(data, ensure_ascii=False, cls=PackageJSONEncoder) - return HttpResponse(to_json, mimetype='application/json') + return HttpResponse(to_json, content_type='application/json') def download(request, name, repo, arch): diff --git a/packages/views/search.py b/packages/views/search.py index f6e670d..0f313cc 100644 --- a/packages/views/search.py +++ b/packages/views/search.py @@ -197,6 +197,6 @@ def search_json(request): container['valid'] = True to_json = json.dumps(container, ensure_ascii=False, cls=PackageJSONEncoder) - return HttpResponse(to_json, mimetype='application/json') + return HttpResponse(to_json, content_type='application/json') # vim: set ts=4 sw=4 et: diff --git a/packages/views/signoff.py b/packages/views/signoff.py index 340b231..17f3095 100644 --- a/packages/views/signoff.py +++ b/packages/views/signoff.py @@ -67,7 +67,7 @@ def signoff_package(request, name, repo, arch, revoke=False): 'user': str(request.user), } return HttpResponse(json.dumps(data, ensure_ascii=False), - mimetype='application/json') + content_type='application/json') return redirect('package-signoffs') @@ -181,7 +181,7 @@ def signoffs_json(request): 'signoff_groups': signoff_groups, } to_json = json.dumps(data, ensure_ascii=False, cls=SignoffJSONEncoder) - response = HttpResponse(to_json, mimetype='application/json') + response = HttpResponse(to_json, content_type='application/json') return response # vim: set ts=4 sw=4 et: -- cgit v1.2.3-24-g4f1b