aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf
diff options
context:
space:
mode:
authormlen108 <matt.lenc@gmail.com>2012-11-14 16:34:27 +0000
committermlen108 <matt.lenc@gmail.com>2012-11-14 16:34:27 +0000
commita73a7fc34fa54b015370e87c51a51a5278280791 (patch)
tree6f569cb1ce04b9680a4056ab38795fa1d29aae9f /wkhtmltopdf
parent2cc80138a7167c5a6adbb75d1b58fd56872077fd (diff)
downloaddjango-wkhtmltopdf-a73a7fc34fa54b015370e87c51a51a5278280791.tar.gz
django-wkhtmltopdf-a73a7fc34fa54b015370e87c51a51a5278280791.tar.bz2
django-wkhtmltopdf-a73a7fc34fa54b015370e87c51a51a5278280791.zip
Tidy up a bit
Diffstat (limited to 'wkhtmltopdf')
-rw-r--r--wkhtmltopdf/views.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py
index 9ff5395..4d0ccca 100644
--- a/wkhtmltopdf/views.py
+++ b/wkhtmltopdf/views.py
@@ -162,11 +162,15 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse):
has_scheme = re.compile(r'^[^:/]+://')
for x in overrides:
- if not has_scheme.match(x['url']):
- if not x['root'].endswith('/'):
- x['root'] += '/'
- for occur in re.findall('''["|']({0}.*?)["|']'''.format(x['url']), content):
- content = content.replace(occur, pathname2fileurl(x['root']) + occur[len(x['url']):])
+ if has_scheme.match(x['url']):
+ continue
+
+ if not x['root'].endswith('/'):
+ x['root'] += '/'
+
+ for occur in re.findall('''["|']({0}.*?)["|']'''.format(x['url']), content):
+ content = content.replace(occur, pathname2fileurl(x['root']) + occur[len(x['url']):])
+
return content