From 690770de89e9f82808f3524be8c9bc3eac553780 Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Wed, 2 Jul 2014 14:37:17 +0200 Subject: Removed mimetype from response for Django 1.7 compatibility. See https://docs.djangoproject.com/en/dev/internals/deprecation/#deprecation-removed-in-1-7 --- wkhtmltopdf/views.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'wkhtmltopdf') diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py index 2f1945d..2d91224 100644 --- a/wkhtmltopdf/views.py +++ b/wkhtmltopdf/views.py @@ -15,14 +15,13 @@ from .utils import (content_disposition_filename, make_absolute_paths, class PDFResponse(HttpResponse): """HttpResponse that sets the headers for PDF output.""" - def __init__(self, content, mimetype=None, status=200, content_type=None, + def __init__(self, content, status=200, content_type=None, filename=None, show_content_in_browser=None, *args, **kwargs): if content_type is None: content_type = 'application/pdf' super(PDFResponse, self).__init__(content=content, - mimetype=mimetype, status=status, content_type=content_type) self.set_filename(filename, show_content_in_browser) @@ -44,7 +43,7 @@ class PDFResponse(HttpResponse): class PDFTemplateResponse(TemplateResponse, PDFResponse): """Renders a Template into a PDF using wkhtmltopdf""" - def __init__(self, request, template, context=None, mimetype=None, + def __init__(self, request, template, context=None, status=None, content_type=None, current_app=None, filename=None, show_content_in_browser=None, header_template=None, footer_template=None, @@ -53,7 +52,6 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse): super(PDFTemplateResponse, self).__init__(request=request, template=template, context=context, - mimetype=mimetype, status=status, content_type=content_type, current_app=None, -- cgit v1.2.3 From eb11c5fca0ae826c5306808bfba683e6cc9e918a Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Thu, 3 Jul 2014 11:46:05 +0200 Subject: Aligned test to code update. --- wkhtmltopdf/tests/tests.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'wkhtmltopdf') diff --git a/wkhtmltopdf/tests/tests.py b/wkhtmltopdf/tests/tests.py index 7365d05..f296c8e 100644 --- a/wkhtmltopdf/tests/tests.py +++ b/wkhtmltopdf/tests/tests.py @@ -78,7 +78,7 @@ class TestViews(TestCase): inline_fileheader = 'inline; filename="{0}"' def test_pdf_response(self): - """Should generate the correct HttpResponse object and mimetype""" + """Should generate the correct HttpResponse object and content type.""" # 404 response = PDFResponse(content='', status=404) self.assertEqual(response.status_code, 404) @@ -130,9 +130,6 @@ class TestViews(TestCase): response = PDFResponse(content=content, content_type='application/x-pdf') self.assertEqual(response['Content-Type'], 'application/x-pdf') - response = PDFResponse(content=content, - mimetype='application/x-pdf') - self.assertEqual(response['Content-Type'], 'application/x-pdf') def test_pdf_template_response(self, show_content=False): """Test PDFTemplateResponse.""" -- cgit v1.2.3