diff options
author | mlen108 <matt.lenc@gmail.com> | 2012-11-13 16:59:12 +0000 |
---|---|---|
committer | mlen108 <matt.lenc@gmail.com> | 2012-11-13 16:59:12 +0000 |
commit | af7fca488f8af4ea50fe3eada0abe8da3fa44f89 (patch) | |
tree | 36f385845c741ff80f8288596a25ffaa2b93b2b6 /wkhtmltopdf/utils.py | |
parent | cf4bd1720b1f6b3cd0fec50752157922796b36eb (diff) | |
download | django-wkhtmltopdf-af7fca488f8af4ea50fe3eada0abe8da3fa44f89.tar.gz django-wkhtmltopdf-af7fca488f8af4ea50fe3eada0abe8da3fa44f89.tar.bz2 django-wkhtmltopdf-af7fca488f8af4ea50fe3eada0abe8da3fa44f89.zip |
Fix images path in PDFs
Diffstat (limited to 'wkhtmltopdf/utils.py')
-rw-r--r-- | wkhtmltopdf/utils.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py index 8e0caef..0111736 100644 --- a/wkhtmltopdf/utils.py +++ b/wkhtmltopdf/utils.py @@ -120,55 +120,3 @@ def http_quote(string): def pathname2fileurl(pathname): """Returns a file:// URL for pathname. Handles OS-specific conversions.""" return 'file://' + urllib.pathname2url(pathname) - - -try: - # From Django 1.4 - from django.conf import override_settings -except ImportError: - class override_settings(object): - """ - Acts as either a decorator, or a context manager. If it's a decorator it - takes a function and returns a wrapped function. If it's a contextmanager - it's used with the ``with`` statement. In either event entering/exiting - are called before and after, respectively, the function/block is executed. - """ - def __init__(self, **kwargs): - self.options = kwargs - self.wrapped = settings._wrapped - - def __enter__(self): - self.enable() - - def __exit__(self, exc_type, exc_value, traceback): - self.disable() - - def __call__(self, test_func): - from django.test import TransactionTestCase - if isinstance(test_func, type) and issubclass(test_func, TransactionTestCase): - original_pre_setup = test_func._pre_setup - original_post_teardown = test_func._post_teardown - def _pre_setup(innerself): - self.enable() - original_pre_setup(innerself) - def _post_teardown(innerself): - original_post_teardown(innerself) - self.disable() - test_func._pre_setup = _pre_setup - test_func._post_teardown = _post_teardown - return test_func - else: - @wraps(test_func) - def inner(*args, **kwargs): - with self: - return test_func(*args, **kwargs) - return inner - - def enable(self): - override = copy(settings._wrapped) - for key, new_value in self.options.items(): - setattr(override, key, new_value) - settings._wrapped = override - - def disable(self): - settings._wrapped = self.wrapped |