diff options
author | Dan McGee <dan@archlinux.org> | 2013-01-13 22:34:33 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-01-13 22:34:33 -0600 |
commit | 66850026ca934e5a09238e9033c541cdc5085a42 (patch) | |
tree | f92873cdc34c2ebf446173513da54b96f9bb156f | |
parent | 019785186ce5861215ece96818513ec21e15df41 (diff) |
Use content_type and not mimetype on HttpResponse()
Bug #16519 in Django deprecates mimetype, so update our code
accordingly.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | mirrors/views.py | 4 | ||||
-rw-r--r-- | packages/views/__init__.py | 4 | ||||
-rw-r--r-- | packages/views/display.py | 4 | ||||
-rw-r--r-- | packages/views/search.py | 2 | ||||
-rw-r--r-- | packages/views/signoff.py | 4 | ||||
-rw-r--r-- | public/views.py | 2 | ||||
-rw-r--r-- | todolists/views.py | 5 | ||||
-rw-r--r-- | visualize/views.py | 4 |
8 files changed, 14 insertions, 15 deletions
diff --git a/mirrors/views.py b/mirrors/views.py index 22da631a..d3867802 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -199,7 +199,7 @@ def mirror_details_json(request, name): data['version'] = 3 to_json = json.dumps(data, ensure_ascii=False, cls=ExtendedMirrorStatusJSONEncoder) - response = HttpResponse(to_json, mimetype='application/json') + response = HttpResponse(to_json, content_type='application/json') return response @@ -285,7 +285,7 @@ def status_json(request): data = status_info.copy() data['version'] = 3 to_json = json.dumps(data, ensure_ascii=False, cls=MirrorStatusJSONEncoder) - response = HttpResponse(to_json, mimetype='application/json') + response = HttpResponse(to_json, content_type='application/json') return response # vim: set ts=4 sw=4 et: diff --git a/packages/views/__init__.py b/packages/views/__init__.py index f7952255..4c195385 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 efedf6ff..445c1abe 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 f6e670df..0f313ccb 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 340b2311..17f3095c 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: diff --git a/public/views.py b/public/views.py index 44ceb45d..65b0c31f 100644 --- a/public/views.py +++ b/public/views.py @@ -185,6 +185,6 @@ def keys_json(request): data = { 'nodes': node_list, 'edges': edge_list } to_json = json.dumps(data, ensure_ascii=False) - 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/todolists/views.py b/todolists/views.py index f4f9ab21..fcf62e23 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -53,7 +53,7 @@ def flag(request, slug, pkg_id): 'status': tlpkg.get_status_display(), 'css_class': tlpkg.status_css_class(), } - return HttpResponse(json.dumps(data), mimetype='application/json') + return HttpResponse(json.dumps(data), content_type='application/json') return redirect(todolist) @@ -87,8 +87,7 @@ def list_pkgbases(request, slug, svn_root): 'pkgbase', flat=True).filter( todolist=todolist, repo__in=repos, removed__isnull=True).order_by( 'pkgbase').distinct() - return HttpResponse('\n'.join(pkgbases), - mimetype='text/plain') + return HttpResponse('\n'.join(pkgbases), content_type='text/plain') def todolist_list(request): diff --git a/visualize/views.py b/visualize/views.py index 48e8f86b..9c537c20 100644 --- a/visualize/views.py +++ b/visualize/views.py @@ -62,13 +62,13 @@ def arch_repo_data(): def by_arch(request): data = arch_repo_data() to_json = json.dumps(data['by_arch'], ensure_ascii=False) - return HttpResponse(to_json, mimetype='application/json') + return HttpResponse(to_json, content_type='application/json') @cache_page(1800) def by_repo(request): data = arch_repo_data() to_json = json.dumps(data['by_repo'], ensure_ascii=False) - return HttpResponse(to_json, mimetype='application/json') + return HttpResponse(to_json, content_type='application/json') # vim: set ts=4 sw=4 et: |