aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/utils.py
diff options
context:
space:
mode:
authorSimon Law <simon.law@ecometrica.com>2012-08-23 16:34:40 -0400
committerSimon Law <simon.law@ecometrica.com>2012-08-23 16:34:40 -0400
commit0aa9bd310e5d66a76a109174f12885d0629861a3 (patch)
tree2dc6de394f24d7d68a5e3e932b07491a7c170dce /wkhtmltopdf/utils.py
parentf90cff165af1ea1ede5cf4679e44735400cd649f (diff)
parent8d8d7ba99640366ac8304390b97a4f03842c1254 (diff)
downloaddjango-wkhtmltopdf-0aa9bd310e5d66a76a109174f12885d0629861a3.tar.gz
django-wkhtmltopdf-0aa9bd310e5d66a76a109174f12885d0629861a3.tar.bz2
django-wkhtmltopdf-0aa9bd310e5d66a76a109174f12885d0629861a3.zip
Merge with incuna
Diffstat (limited to 'wkhtmltopdf/utils.py')
-rw-r--r--wkhtmltopdf/utils.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index 29e4ef6..99998a2 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -1,23 +1,19 @@
from __future__ import absolute_import
from copy import copy
+from functools import wraps
from itertools import chain
-from os import fdopen
import os
import sys
-from tempfile import mkstemp
import urllib
-import warnings
from django.conf import settings
-from django.template import loader
-from django.utils.encoding import smart_str
from .subprocess import check_output
def _options_to_args(**options):
- """Converts ``options`` into a string of command-line arguments."""
+ """Converts ``options`` into a list of command-line arguments."""
flags = []
for name in sorted(options):
value = options[name]
@@ -87,18 +83,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