Merge pull request #561 from thenewguy/quote_on_windows

shlex.quote/pipes.quote is not compatible with Windows
This commit is contained in:
Jannis Leidel
2014-12-30 13:49:33 +01:00

View File

@@ -3,10 +3,18 @@ import io
import logging
import subprocess
try:
from shlex import quote as shell_quote # Python 3
except ImportError:
from pipes import quote as shell_quote # Python 2
from platform import system
if system() != "Windows":
try:
from shlex import quote as shell_quote # Python 3
except ImportError:
from pipes import quote as shell_quote # Python 2
else:
from subprocess import list2cmdline
def shell_quote(s):
# shlex.quote/pipes.quote is not compatible with Windows
return list2cmdline([s])
from django.core.exceptions import ImproperlyConfigured
from django.core.files.temp import NamedTemporaryFile