aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf
diff options
context:
space:
mode:
authormattack108 <matt.lenc@gmail.com>2013-01-15 11:59:25 +0000
committermattack108 <matt.lenc@gmail.com>2013-01-15 11:59:25 +0000
commitd11ef5c17b766241762faa8a38587e298e296459 (patch)
tree22f6bff436cd4dbbf7461c41b67e0d8189e25f23 /wkhtmltopdf
parent887d3c6600750dd573e768c6fdf370a6a607d39b (diff)
downloaddjango-wkhtmltopdf-d11ef5c17b766241762faa8a38587e298e296459.tar.gz
django-wkhtmltopdf-d11ef5c17b766241762faa8a38587e298e296459.tar.bz2
django-wkhtmltopdf-d11ef5c17b766241762faa8a38587e298e296459.zip
PEP8 all the things!
Diffstat (limited to 'wkhtmltopdf')
-rw-r--r--wkhtmltopdf/views.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py
index 94cbbf9..e888d09 100644
--- a/wkhtmltopdf/views.py
+++ b/wkhtmltopdf/views.py
@@ -16,7 +16,7 @@ class PDFResponse(HttpResponse):
"""HttpResponse that sets the headers for PDF output."""
def __init__(self, content, mimetype=None, status=200, content_type=None,
- filename=None, show_content_in_browser=None, *args, **kwargs):
+ filename=None, show_content_in_browser=None, *args, **kwargs):
if content_type is None:
content_type = 'application/pdf'
@@ -149,19 +149,17 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse):
f.close()
def make_absolute_paths(self, content):
- """Convert all MEDIA files into a file://URL paths in order to correctly get it displayed in PDFs
-
- mattl's disclaimer: I know it sucks, but it works and I haz no time for better solution now
- """
+ """Convert all MEDIA files into a file://URL paths in order to
+ correctly get it displayed in PDFs."""
overrides = [
{
- 'root': settings.MEDIA_ROOT,
- 'url': settings.MEDIA_URL,
+ 'root': settings.MEDIA_ROOT,
+ 'url': settings.MEDIA_URL,
},
{
- 'root': settings.STATIC_ROOT,
- 'url': settings.STATIC_URL,
+ 'root': settings.STATIC_ROOT,
+ 'url': settings.STATIC_URL,
}
]
has_scheme = re.compile(r'^[^:/]+://')
@@ -173,8 +171,8 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse):
if not x['root'].endswith('/'):
x['root'] += '/'
- occurences = re.findall('''["|']({0}.*?)["|']'''.format(x['url']),
- content)
+ occur_pattern = '''["|']({0}.*?)["|']'''
+ occurences = re.findall(occur_pattern.format(x['url']), content)
occurences = list(set(occurences)) # Remove dups
for occur in occurences:
content = content.replace(occur,
@@ -190,7 +188,7 @@ class PDFTemplateView(TemplateView):
# Filename for downloaded PDF. If None, the response is inline.
filename = 'rendered_pdf.pdf'
- # Send file as attachement, or if True render content in the browser.
+ # Send file as attachement. If True render content in the browser.
show_content_in_browser = False
# Filenames for the content, header, and footer templates.