Merge pull request #561 from thenewguy/quote_on_windows
shlex.quote/pipes.quote is not compatible with Windows
This commit is contained in:
		| @@ -3,10 +3,18 @@ import io | |||||||
| import logging | import logging | ||||||
| import subprocess | import subprocess | ||||||
|  |  | ||||||
| try: | from platform import system | ||||||
|     from shlex import quote as shell_quote  # Python 3 |  | ||||||
| except ImportError: | if system() != "Windows": | ||||||
|     from pipes import quote as shell_quote  # Python 2 |     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.exceptions import ImproperlyConfigured | ||||||
| from django.core.files.temp import NamedTemporaryFile | from django.core.files.temp import NamedTemporaryFile | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jannis Leidel
					Jannis Leidel