aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wkhtmltopdf/utils.py2
-rw-r--r--wkhtmltopdf/views.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index 9907f93..63310c3 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -80,7 +80,7 @@ def wkhtmltopdf(pages, output=None, **kwargs):
env = dict(os.environ, **env)
cmd = getattr(settings, 'WKHTMLTOPDF_CMD', 'wkhtmltopdf')
- args = list(chain([cmd],
+ args = list(chain(cmd.split(),
_options_to_args(**options),
list(pages),
[output]))
diff --git a/wkhtmltopdf/views.py b/wkhtmltopdf/views.py
index 4d0ccca..fd5b8c8 100644
--- a/wkhtmltopdf/views.py
+++ b/wkhtmltopdf/views.py
@@ -168,8 +168,13 @@ class PDFTemplateResponse(TemplateResponse, PDFResponse):
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']):])
+ occurences = re.findall('''["|']({0}.*?)["|']'''.format(x['url']),
+ content)
+ occurences = list(set(occurences)) # Remove dups
+ for occur in occurences:
+ content = content.replace(occur,
+ pathname2fileurl(x['root']) +
+ occur[len(x['url']):])
return content