~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to django/contrib/staticfiles/views.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
"""
6
6
import os
7
7
import posixpath
8
 
import urllib
 
8
try:
 
9
    from urllib.parse import unquote
 
10
except ImportError:     # Python 2
 
11
    from urllib import unquote
9
12
 
10
13
from django.conf import settings
11
14
from django.core.exceptions import ImproperlyConfigured
29
32
    """
30
33
    if not settings.DEBUG and not insecure:
31
34
        raise ImproperlyConfigured("The staticfiles view can only be used in "
32
 
                                   "debug mode or if the the --insecure "
 
35
                                   "debug mode or if the --insecure "
33
36
                                   "option of 'runserver' is used")
34
 
    normalized_path = posixpath.normpath(urllib.unquote(path)).lstrip('/')
 
37
    normalized_path = posixpath.normpath(unquote(path)).lstrip('/')
35
38
    absolute_path = finders.find(normalized_path)
36
39
    if not absolute_path:
37
40
        if path.endswith('/') or path == '':