aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Hickman <george@ghickman.co.uk>2013-09-20 01:13:45 -0700
committerGeorge Hickman <george@ghickman.co.uk>2013-09-20 01:13:45 -0700
commita6b9b5b10ade0b899ca146d2533708f6991379bc (patch)
tree3fa29f572286edc71b355a5913b13e5847d9361c
parent38a29d421f19594427e4735314e4921d4dc293af (diff)
parentca8a2128f2b1cb677b8e2268323ac6d82111ee3e (diff)
downloaddjango-wkhtmltopdf-a6b9b5b10ade0b899ca146d2533708f6991379bc.tar.gz
django-wkhtmltopdf-a6b9b5b10ade0b899ca146d2533708f6991379bc.tar.bz2
django-wkhtmltopdf-a6b9b5b10ade0b899ca146d2533708f6991379bc.zip
Merge pull request #40 from gmcguire/master
Test sys.stderr to ensure it hasn't been overridden
-rw-r--r--wkhtmltopdf/utils.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index e5bd102..be6bc6a 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -81,11 +81,14 @@ def wkhtmltopdf(pages, output=None, **kwargs):
env = dict(os.environ, **env)
cmd = getattr(settings, 'WKHTMLTOPDF_CMD', 'wkhtmltopdf')
- args = list(chain(cmd.split(),
- _options_to_args(**options),
- list(pages),
- [output]))
- return check_output(args, stderr=sys.stderr, env=env)
+ ck_args = list(chain(cmd.split(),
+ _options_to_args(**options),
+ list(pages),
+ [output]))
+ ck_kwargs = {'env': env}
+ if hasattr(sys.stderr, 'fileno'):
+ ck_kwargs['stderr'] = sys.stderr
+ return check_output(ck_args, **ck_kwargs)
def content_disposition_filename(filename):