diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-20 15:36:52 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-22 09:29:55 +0200 |
| commit | 0d914d08a0d7b5a1521f498a8047971fe6cd61e7 (patch) | |
| tree | d0ab08b0b5b2041bd796c10a26a358ae60d0914a /django/contrib/staticfiles/views.py | |
| parent | bdca5ea345c548a82a80d198906818c9ccbef896 (diff) | |
[py3] Updated urllib/urllib2/urlparse imports.
Lots of functions were moved. Use explicit imports in all cases
to keey it easy to identify where the functions come from.
Diffstat (limited to 'django/contrib/staticfiles/views.py')
| -rw-r--r-- | django/contrib/staticfiles/views.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/django/contrib/staticfiles/views.py b/django/contrib/staticfiles/views.py index 1a9c166ad7..85459812ad 100644 --- a/django/contrib/staticfiles/views.py +++ b/django/contrib/staticfiles/views.py @@ -5,7 +5,10 @@ development, and SHOULD NOT be used in a production setting. """ import os import posixpath -import urllib +try: + from urllib.parse import unquote +except ImportError: # Python 2 + from urllib import unquote from django.conf import settings from django.core.exceptions import ImproperlyConfigured @@ -31,7 +34,7 @@ def serve(request, path, document_root=None, insecure=False, **kwargs): raise ImproperlyConfigured("The staticfiles view can only be used in " "debug mode or if the the --insecure " "option of 'runserver' is used") - normalized_path = posixpath.normpath(urllib.unquote(path)).lstrip('/') + normalized_path = posixpath.normpath(unquote(path)).lstrip('/') absolute_path = finders.find(normalized_path) if not absolute_path: if path.endswith('/') or path == '': |
