From a73a7fc34fa54b015370e87c51a51a5278280791 Mon Sep 17 00:00:00 2001 From: mlen108 Date: Wed, 14 Nov 2012 16:34:27 +0000 Subject: Tidy up a bit --- wkhtmltopdf/views.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'wkhtmltopdf') 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 -- cgit v1.2.3