diff options
author | Michel Sabchuk <michel@turbosys.com.br> | 2014-09-01 10:51:14 -0300 |
---|---|---|
committer | Michel Sabchuk <michel@turbosys.com.br> | 2014-09-01 10:51:14 -0300 |
commit | 8e1715bdbcc504a9ea815e401c064a6759077a2d (patch) | |
tree | f48044ed9dfcf841ec474c5f5f5aa54c5bf86b87 /wkhtmltopdf/views.py | |
parent | b6d9a18528e79673412714fb7c6d3e9826e89421 (diff) | |
download | django-wkhtmltopdf-8e1715bdbcc504a9ea815e401c064a6759077a2d.tar.gz django-wkhtmltopdf-8e1715bdbcc504a9ea815e401c064a6759077a2d.tar.bz2 django-wkhtmltopdf-8e1715bdbcc504a9ea815e401c064a6759077a2d.zip |
Replace smart_str with smart_text/unicode for py2.x compat.
Diffstat (limited to 'wkhtmltopdf/views.py')
-rw-r--r-- | wkhtmltopdf/views.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py index 2d91224..882f4fa 100644 --- a/wkhtmltopdf/views.py +++ b/wkhtmltopdf/views.py @@ -5,8 +5,11 @@ from tempfile import NamedTemporaryFile from django.conf import settings from django.http import HttpResponse from django.template.response import TemplateResponse -from django.utils.encoding import smart_str from django.views.generic import TemplateView +try: + from django.utils.encoding import smart_text +except ImportError: + from django.utils.encoding import smart_unicode as smart_text from .utils import (content_disposition_filename, make_absolute_paths, wkhtmltopdf) @@ -72,7 +75,7 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse): context = self.resolve_context(self.context_data) - content = smart_str(template.render(context)) + content = smart_text(template.render(context)) content = make_absolute_paths(content) try: |