diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-06-07 18:08:47 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-06-07 18:08:47 +0200 |
| commit | 4a103086d5c67fa4fcc53c106c9fdf644c742dd8 (patch) | |
| tree | 3df00600c27f6369f7561c3b8ddf2f97d2d341d9 /django/views/static.py | |
| parent | 706fd9adc0b6587c7f96a834c757708e64fcf615 (diff) | |
Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
Diffstat (limited to 'django/views/static.py')
| -rw-r--r-- | django/views/static.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/views/static.py b/django/views/static.py index 2a756134a6..1d7891e3f4 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -2,6 +2,7 @@ Views and functions for serving static files. These are only to be used during development, and SHOULD NOT be used in a production setting. """ +from __future__ import unicode_literals import mimetypes import os @@ -48,9 +49,9 @@ def serve(request, path, document_root=None, show_indexes=False): if os.path.isdir(fullpath): if show_indexes: return directory_index(newpath, fullpath) - raise Http404(_(u"Directory indexes are not allowed here.")) + raise Http404(_("Directory indexes are not allowed here.")) if not os.path.exists(fullpath): - raise Http404(_(u'"%(path)s" does not exist') % {'path': fullpath}) + raise Http404(_('"%(path)s" does not exist') % {'path': fullpath}) # Respect the If-Modified-Since header. statobj = os.stat(fullpath) mimetype, encoding = mimetypes.guess_type(fullpath) @@ -91,7 +92,7 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ </body> </html> """ -template_translatable = ugettext_noop(u"Index of %(directory)s") +template_translatable = ugettext_noop("Index of %(directory)s") def directory_index(path, fullpath): try: |
