aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf
diff options
context:
space:
mode:
authorSimon Law <simon.law@ecometrica.com>2012-07-26 12:46:58 -0400
committerSimon Law <simon.law@ecometrica.com>2012-07-26 12:46:58 -0400
commitfd3c890e2ecd2b5448ee7ca65503c2b31ac92ddb (patch)
tree6eea45aa3a68fece4c9ae6add826eed50920c380 /wkhtmltopdf
parent85daece4ed63036ef9906d795c5e1cbe38253800 (diff)
downloaddjango-wkhtmltopdf-fd3c890e2ecd2b5448ee7ca65503c2b31ac92ddb.tar.gz
django-wkhtmltopdf-fd3c890e2ecd2b5448ee7ca65503c2b31ac92ddb.tar.bz2
django-wkhtmltopdf-fd3c890e2ecd2b5448ee7ca65503c2b31ac92ddb.zip
Python 2.6 compatibility fixes.
Implicit position arguments for str.format() are a 2.7ism.
Diffstat (limited to 'wkhtmltopdf')
-rw-r--r--wkhtmltopdf/tests.py20
-rw-r--r--wkhtmltopdf/utils.py2
2 files changed, 11 insertions, 11 deletions
diff --git a/wkhtmltopdf/tests.py b/wkhtmltopdf/tests.py
index 764c7f2..3bdc481 100644
--- a/wkhtmltopdf/tests.py
+++ b/wkhtmltopdf/tests.py
@@ -177,16 +177,16 @@ class TestViews(TestCase):
tempfile.seek(0)
footer_content = tempfile.read()
- media_url = 'MEDIA_URL = file://{}/'.format(settings.MEDIA_ROOT)
+ media_url = 'MEDIA_URL = file://{0}/'.format(settings.MEDIA_ROOT)
self.assertTrue(
media_url in footer_content,
- "{!r} not in {!r}".format(media_url, footer_content)
+ "{0!r} not in {1!r}".format(media_url, footer_content)
)
- static_url = 'STATIC_URL = file://{}/'.format(settings.STATIC_ROOT)
+ static_url = 'STATIC_URL = file://{0}/'.format(settings.STATIC_ROOT)
self.assertTrue(
static_url in footer_content,
- "{!r} not in {!r}".format(static_url, footer_content)
+ "{0!r} not in {1!r}".format(static_url, footer_content)
)
pdf_content = response.rendered_content
@@ -207,10 +207,10 @@ class TestViews(TestCase):
tempfile.seek(0)
footer_content = tempfile.read()
- static_url = 'STATIC_URL = {}'.format('file:///tmp/s/')
+ static_url = 'STATIC_URL = {0}'.format('file:///tmp/s/')
self.assertTrue(
static_url in footer_content,
- "{!r} not in {!r}".format(static_url, footer_content)
+ "{0!r} not in {1!r}".format(static_url, footer_content)
)
self.assertEqual(settings.STATIC_URL, '/static/')
@@ -241,7 +241,7 @@ class TestViews(TestCase):
self.assertEqual(response.status_code, 200)
response.render()
self.assertEqual(response['Content-Disposition'],
- 'attachment; filename="{}"'.format(filename))
+ 'attachment; filename="{0}"'.format(filename))
self.assertTrue(response.content.startswith('%PDF-'))
self.assertTrue(response.content.endswith('%%EOF\n'))
@@ -285,7 +285,7 @@ class TestViews(TestCase):
self.assertEqual(w[0].category, PendingDeprecationWarning)
self.assertTrue(
'PDFTemplateView' in str(w[0].message),
- "'PDFTemplateView' not in {!r}".format(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)
@@ -293,7 +293,7 @@ class TestViews(TestCase):
self.assertEqual(w[0].category, PendingDeprecationWarning)
self.assertTrue(
'PDFResponse' in str(w[0].message),
- "'PDFResponse' not in {!r}".format(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()
@@ -301,4 +301,4 @@ class TestViews(TestCase):
self.assertEqual(w[0].category, PendingDeprecationWarning)
self.assertTrue(
'get_pdf_kwargs()' in str(w[0].message),
- "'get_pdf_kwargs()' not in {!r}".format(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 3172c42..29e4ef6 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -127,7 +127,7 @@ def http_quote(string):
except ImportError:
string = string.encode('ascii', 'replace')
# Wrap in double-quotes for ; , and the like
- return '"{!s}"'.format(string.replace('\\', '\\\\').replace('"', '\\"'))
+ return '"{0!s}"'.format(string.replace('\\', '\\\\').replace('"', '\\"'))
def pathname2fileurl(pathname):