aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wkhtmltopdf/tests.py28
-rw-r--r--wkhtmltopdf/utils.py13
2 files changed, 0 insertions, 41 deletions
diff --git a/wkhtmltopdf/tests.py b/wkhtmltopdf/tests.py
index 3bdc481..c55d6f9 100644
--- a/wkhtmltopdf/tests.py
+++ b/wkhtmltopdf/tests.py
@@ -4,7 +4,6 @@ from __future__ import absolute_import
import os
import sys
-import warnings
from django.test import TestCase
from django.test.client import RequestFactory
@@ -275,30 +274,3 @@ class TestViews(TestCase):
view.cmd_options.update(cmd_options)
self.assertEqual(view.cmd_options, cmd_options)
self.assertEqual(PDFTemplateView.cmd_options, {})
-
- def test_deprecated(self):
- """Should warn when using deprecated views."""
- with warnings.catch_warnings(record=True) as w:
- warnings.simplefilter('always')
- PdfTemplateView()
- self.assertEqual(len(w), 1)
- self.assertEqual(w[0].category, PendingDeprecationWarning)
- self.assertTrue(
- 'PDFTemplateView' in str(w[0].message),
- "'PDFTemplateView' not in {0!r}".format(w[0].message))
- with warnings.catch_warnings(record=True) as w:
- warnings.simplefilter('always')
- PdfResponse(None, None)
- self.assertEqual(len(w), 1)
- self.assertEqual(w[0].category, PendingDeprecationWarning)
- self.assertTrue(
- 'PDFResponse' in str(w[0].message),
- "'PDFResponse' not in {0!r}".format(w[0].message))
- with warnings.catch_warnings(record=True) as w:
- warnings.simplefilter('always')
- PDFTemplateView().get_pdf_kwargs()
- self.assertEqual(len(w), 1)
- self.assertEqual(w[0].category, PendingDeprecationWarning)
- self.assertTrue(
- 'get_pdf_kwargs()' in str(w[0].message),
- "'get_pdf_kwargs()' not in {0!r}".format(w[0].message))
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index 69114b7..f95eddf 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -7,7 +7,6 @@ import os
import sys
from tempfile import mkstemp
import urllib
-import warnings
from django.conf import settings
from django.template import loader
@@ -87,18 +86,6 @@ def wkhtmltopdf(pages, output=None, **kwargs):
return check_output(args, stderr=sys.stderr, env=env)
-def template_to_temp_file(template_name, dictionary=None, context_instance=None):
- """
- Renders a template to a temp file, and returns the path of the file.
- """
- warnings.warn('template_to_temp_file is deprecated in favour of PDFResponse. It will be removed in version 1.',
- PendingDeprecationWarning, 2)
- file_descriptor, tempfile_path = mkstemp(suffix='.html')
- with fdopen(file_descriptor, 'wt') as f:
- f.write(smart_str(loader.render_to_string(template_name, dictionary=dictionary, context_instance=context_instance)))
- return tempfile_path
-
-
def content_disposition_filename(filename):
"""
Sanitize a file name to be used in the Content-Disposition HTTP