]> git.ozlabs.org Git - patchwork/commitdiff
views: Replace 'mimetype' with 'content_type'
authorStephen Finucane <stephenfinucane@hotmail.com>
Tue, 7 Apr 2015 21:20:49 +0000 (22:20 +0100)
committerJeremy Kerr <jk@ozlabs.org>
Sun, 3 May 2015 05:46:52 +0000 (13:46 +0800)
Passing 'mimetype' to 'HttpResponse' is deprecated in 1.6 and
removed in Django 1.7. Among other things, this causes some unit
tests to fail when using Django 1.7. Its replacement - 'content_type'
- is available in Django 1.5+. This can be seen here:

    https://docs.djangoproject.com/en/1.5/ref/request-response/#django.http.HttpResponse.__init__

This is therefore a like-for-like replacement.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/views/base.py
apps/patchwork/views/bundle.py
apps/patchwork/views/patch.py

index fa7dd998335ac11ad163f41d84227570e4363efa..6d7dd13a67db3e6735ce08c9262a58fbd5e48701 100644 (file)
@@ -47,14 +47,14 @@ def pwclientrc(request, project_id):
         context['scheme'] = 'https'
     else:
         context['scheme'] = 'http'
-    response = HttpResponse(mimetype = "text/plain")
+    response = HttpResponse(content_type = "text/plain")
     response['Content-Disposition'] = 'attachment; filename=.pwclientrc'
     response.write(render_to_string('patchwork/pwclientrc', context))
     return response
 
 def pwclient(request):
     context = PatchworkRequestContext(request)
-    response = HttpResponse(mimetype = "text/x-python")
+    response = HttpResponse(content_type = "text/x-python")
     response['Content-Disposition'] = 'attachment; filename=pwclient'
     response.write(render_to_string('patchwork/pwclient', context))
     return response
@@ -87,7 +87,7 @@ def confirm(request, key):
 def submitter_complete(request):
     search = request.GET.get('q', '')
     limit = request.GET.get('l', None)
-    response = HttpResponse(mimetype = "text/plain")
+    response = HttpResponse(content_type = "text/plain")
 
     if len(search) <= 3:
         return response
index c99e3222dca95dd17f04b337494e270edc2bde07..3fb47e2fa5a91848e7b7eb95cb6d11076db9e78c 100644 (file)
@@ -196,7 +196,7 @@ def mbox(request, username, bundlename):
     mbox = '\n'.join([patch_to_mbox(p).as_string(True)
                         for p in bundle.ordered_patches()])
 
-    response = HttpResponse(mimetype='text/plain')
+    response = HttpResponse(content_type='text/plain')
     response['Content-Disposition'] = \
        'attachment; filename=bundle-%d-%s.mbox' % (bundle.id, bundle.name)
 
index 5eedcb56acbf0b769df0fb5c8ee46da6217cafeb..62ff8531b02967d83094b8732586c1acdbb31b38 100644 (file)
@@ -85,7 +85,7 @@ def patch(request, patch_id):
 
 def content(request, patch_id):
     patch = get_object_or_404(Patch, id=patch_id)
-    response = HttpResponse(mimetype="text/x-patch")
+    response = HttpResponse(content_type="text/x-patch")
     response.write(patch.content)
     response['Content-Disposition'] = 'attachment; filename=' + \
         patch.filename().replace(';', '').replace('\n', '')
@@ -93,7 +93,7 @@ def content(request, patch_id):
 
 def mbox(request, patch_id):
     patch = get_object_or_404(Patch, id=patch_id)
-    response = HttpResponse(mimetype="text/plain")
+    response = HttpResponse(content_type="text/plain")
     response.write(patch_to_mbox(patch).as_string(True))
     response['Content-Disposition'] = 'attachment; filename=' + \
         patch.filename().replace(';', '').replace('\n', '')