aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'wkhtmltopdf/utils.py')
-rw-r--r--wkhtmltopdf/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index 03a5f82..69da74f 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -5,6 +5,7 @@ from itertools import chain
from os import fdopen
import sys
from tempfile import mkstemp
+import urllib
import warnings
from django.conf import settings
@@ -124,6 +125,11 @@ def http_quote(string):
return '"{!s}"'.format(string.replace('\\', '\\\\').replace('"', '\\"'))
+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