diff options
author | James Turnbull <james@incuna.com> | 2015-07-31 16:43:59 +0100 |
---|---|---|
committer | James Turnbull <james@incuna.com> | 2015-07-31 16:43:59 +0100 |
commit | 28b58d722c8426be81d3a408e214873dc1dc0b4a (patch) | |
tree | e740d23a73338b84d7a1d55e5c85aed31da8aedf /wkhtmltopdf | |
parent | c98062dcfea8c51eaca96a69facb49268bf7aaa4 (diff) | |
parent | 4b73d48254749bbf08c42126f10b16ac2d71f004 (diff) | |
download | django-wkhtmltopdf-28b58d722c8426be81d3a408e214873dc1dc0b4a.tar.gz django-wkhtmltopdf-28b58d722c8426be81d3a408e214873dc1dc0b4a.tar.bz2 django-wkhtmltopdf-28b58d722c8426be81d3a408e214873dc1dc0b4a.zip |
Merge pull request #85 from powderflask/master
Skip absolute path substitution where STATIC or MEDIA URL are empty or None
Diffstat (limited to 'wkhtmltopdf')
-rw-r--r-- | wkhtmltopdf/utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py index 40e1809..f9d7ac1 100644 --- a/wkhtmltopdf/utils.py +++ b/wkhtmltopdf/utils.py @@ -94,8 +94,13 @@ def wkhtmltopdf(pages, output=None, **kwargs): list(pages), [output])) ck_kwargs = {'env': env} - if hasattr(sys.stderr, 'fileno'): + try: + i = sys.stderr.fileno() ck_kwargs['stderr'] = sys.stderr + except AttributeError: + # can't call fileno() on mod_wsgi stderr object + pass + return check_output(ck_args, **ck_kwargs) @@ -153,7 +158,7 @@ def make_absolute_paths(content): has_scheme = re.compile(r'^[^:/]+://') for x in overrides: - if has_scheme.match(x['url']): + if not x['url'] or has_scheme.match(x['url']): continue if not x['root'].endswith('/'): |