aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Law <simon.law@ecometrica.com>2012-07-20 15:54:02 -0400
committerSimon Law <simon.law@ecometrica.com>2012-07-20 15:54:02 -0400
commit6f7d08e0ec7b3c46ea6e9e6aae7fbc9327df29b4 (patch)
tree42849df3e8831bf905a4dfe44896b09ff8654e23
parenta377496b5a9bfab824b52a7f2e69a64f194930b8 (diff)
downloaddjango-wkhtmltopdf-6f7d08e0ec7b3c46ea6e9e6aae7fbc9327df29b4.tar.gz
django-wkhtmltopdf-6f7d08e0ec7b3c46ea6e9e6aae7fbc9327df29b4.tar.bz2
django-wkhtmltopdf-6f7d08e0ec7b3c46ea6e9e6aae7fbc9327df29b4.zip
settings.WKHTMLTOPDF_CMD is loaded on-the-fly, not at the module level.
This allows overriding this configuration option at run-time.
-rw-r--r--wkhtmltopdf/utils.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index aab4152..ce32621 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -11,8 +11,6 @@ from django.utils.encoding import smart_str
from .subprocess import check_output
-WKHTMLTOPDF_CMD = getattr(settings, 'WKHTMLTOPDF_CMD', 'wkhtmltopdf')
-
def _options_to_args(**options):
"""Converts ``options`` into a string of command-line arguments."""
@@ -63,7 +61,8 @@ def wkhtmltopdf(pages, output=None, **kwargs):
}
options.update(kwargs)
- args = list(chain([WKHTMLTOPDF_CMD],
+ cmd = getattr(settings, 'WKHTMLTOPDF_CMD', 'wkhtmltopdf')
+ args = list(chain([cmd],
_options_to_args(**options),
list(pages),
[output]))