diff options
author | Filipp Lepalaan <filipp@mac.com> | 2017-01-27 17:19:40 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2017-01-27 17:19:40 +0200 |
commit | a16194284278bcd3c1598d143eb59f0cf5743f73 (patch) | |
tree | 4911c10c5b3832c64b0bb31745bb454aedf42a68 | |
parent | f857631011e4ef0642647b44623ffc8bc138d2cc (diff) | |
download | django-wkhtmltopdf-a16194284278bcd3c1598d143eb59f0cf5743f73.tar.gz django-wkhtmltopdf-a16194284278bcd3c1598d143eb59f0cf5743f73.tar.bz2 django-wkhtmltopdf-a16194284278bcd3c1598d143eb59f0cf5743f73.zip |
Keep the ignore_404 flag in env
To match behaviour in utils.py
-rw-r--r-- | wkhtmltopdf/process.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/wkhtmltopdf/process.py b/wkhtmltopdf/process.py index d36aacb..f2417fb 100644 --- a/wkhtmltopdf/process.py +++ b/wkhtmltopdf/process.py @@ -25,7 +25,7 @@ def check_output(*popenargs, **kwargs): Calling check_output without the ignore_404 keyword argument will raise a CalledProcessError if wkhtmltopdf exits with a non-zero code - >>> check_output(['wkhtmltopdf', #doctest: +ELLIPSIS + >>> check_output(['wkhtmltopdf', #doctest: +ELLIPSIS ... '--quiet', ... '--encoding', 'utf8', ... os.getenv('WKHTML_IN'), os.getenv('WKHTML_OUT')]) @@ -36,21 +36,21 @@ def check_output(*popenargs, **kwargs): Calling check_output WITH the ignore_404 keyword will not raise the CalledProcessError, but only if the error == ContentNotFoundError - >>> check_output(['wkhtmltopdf', + >>> check_output(['/usr/local/bin/wkhtmltopdf', ... '--quiet', ... '--encoding', 'utf8', ... os.getenv('WKHTML_IN'), os.getenv('WKHTML_OUT')], - ... ignore_404=True) + ... env={'ignore_404': True}) '' Calling check_output WITH the ignore_404 keyword should still raise a CalledProcessError if the error != ContentNotFoundError - >>> check_output(['wkhtmltopdf', #doctest: +ELLIPSIS + >>> check_output(['/usr/local/bin/wkhtmltopdf', #doctest: +ELLIPSIS ... '--blaa', ... '--encoding', 'utf8', ... os.getenv('WKHTML_IN'), os.getenv('WKHTML_OUT')], - ... ignore_404=True) + ... env={'ignore_404': True}) Traceback (most recent call last): ... CalledProcessError... @@ -58,7 +58,10 @@ def check_output(*popenargs, **kwargs): if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') - ignore_404 = kwargs.pop('ignore_404', False) + if 'env' in kwargs: + ignore_404 = kwargs['env'].pop('ignore_404', False) + else: + ignore_404 = False if not kwargs.get('stderr'): kwargs['stderr'] = PIPE |