diff options
| author | Tim Graham <timograham@gmail.com> | 2015-02-09 13:19:34 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-09 14:24:06 -0500 |
| commit | a8b70d251d238b4e6cfc7bb4296da15494f8dff3 (patch) | |
| tree | 94ef5bc53e59131906aecfcf792eeac86242aa62 /django/views | |
| parent | eb406aa686ff1809903366ef6896037af2f1f69b (diff) | |
[1.8.x] Sorted imports with isort; refs #23860.
Backport of 0ed7d155635da9f79d4dd67e4889087d3673c6da from master
Diffstat (limited to 'django/views')
| -rw-r--r-- | django/views/csrf.py | 1 | ||||
| -rw-r--r-- | django/views/debug.py | 13 | ||||
| -rw-r--r-- | django/views/decorators/cache.py | 7 | ||||
| -rw-r--r-- | django/views/decorators/csrf.py | 5 | ||||
| -rw-r--r-- | django/views/decorators/gzip.py | 2 | ||||
| -rw-r--r-- | django/views/decorators/http.py | 10 | ||||
| -rw-r--r-- | django/views/decorators/vary.py | 1 | ||||
| -rw-r--r-- | django/views/defaults.py | 2 | ||||
| -rw-r--r-- | django/views/generic/base.py | 4 | ||||
| -rw-r--r-- | django/views/generic/dates.py | 13 | ||||
| -rw-r--r-- | django/views/generic/detail.py | 2 | ||||
| -rw-r--r-- | django/views/generic/edit.py | 7 | ||||
| -rw-r--r-- | django/views/generic/list.py | 4 | ||||
| -rw-r--r-- | django/views/i18n.py | 12 | ||||
| -rw-r--r-- | django/views/static.py | 10 |
15 files changed, 56 insertions, 37 deletions
diff --git a/django/views/csrf.py b/django/views/csrf.py index a709e5fc1c..aa227d3b6e 100644 --- a/django/views/csrf.py +++ b/django/views/csrf.py @@ -4,6 +4,7 @@ from django.template import Context, Template from django.utils.translation import ugettext as _ from django.utils.version import get_docs_version + # We include the template inline since we need to be able to reliably display # this error message, especially for the sake of developers, and there isn't any # other way of making it available independent of what is in the settings file. diff --git a/django/views/debug.py b/django/views/debug.py index 19254c5cf2..0a4aa8f74d 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -7,20 +7,19 @@ import sys import types from django.conf import settings -from django.core.urlresolvers import resolve, Resolver404 -from django.http import (HttpResponse, HttpResponseNotFound, HttpRequest, - build_request_repr) +from django.core.urlresolvers import Resolver404, resolve +from django.http import ( + HttpRequest, HttpResponse, HttpResponseNotFound, build_request_repr, +) from django.template import Context, Engine, TemplateDoesNotExist from django.template.defaultfilters import force_escape, pprint +from django.utils import lru_cache, six from django.utils.datastructures import MultiValueDict -from django.utils.html import escape from django.utils.encoding import force_bytes, smart_text -from django.utils import lru_cache +from django.utils.html import escape from django.utils.module_loading import import_string -from django.utils import six from django.utils.translation import ugettext as _ - # Minimal Django templates engine to render the error templates # regardless of the project's TEMPLATES setting. DEBUG_ENGINE = Engine(debug=True) diff --git a/django/views/decorators/cache.py b/django/views/decorators/cache.py index f52169db4f..07e0e70946 100644 --- a/django/views/decorators/cache.py +++ b/django/views/decorators/cache.py @@ -1,7 +1,10 @@ from functools import wraps -from django.utils.decorators import decorator_from_middleware_with_args, available_attrs -from django.utils.cache import patch_cache_control, add_never_cache_headers + from django.middleware.cache import CacheMiddleware +from django.utils.cache import add_never_cache_headers, patch_cache_control +from django.utils.decorators import ( + available_attrs, decorator_from_middleware_with_args, +) def cache_page(*args, **kwargs): diff --git a/django/views/decorators/csrf.py b/django/views/decorators/csrf.py index 1ebed2a6a1..d8c89c176c 100644 --- a/django/views/decorators/csrf.py +++ b/django/views/decorators/csrf.py @@ -1,7 +1,8 @@ -from django.middleware.csrf import CsrfViewMiddleware, get_token -from django.utils.decorators import decorator_from_middleware, available_attrs from functools import wraps +from django.middleware.csrf import CsrfViewMiddleware, get_token +from django.utils.decorators import available_attrs, decorator_from_middleware + csrf_protect = decorator_from_middleware(CsrfViewMiddleware) csrf_protect.__name__ = "csrf_protect" csrf_protect.__doc__ = """ diff --git a/django/views/decorators/gzip.py b/django/views/decorators/gzip.py index f5b009db4a..96d6aa805e 100644 --- a/django/views/decorators/gzip.py +++ b/django/views/decorators/gzip.py @@ -1,5 +1,5 @@ -from django.utils.decorators import decorator_from_middleware from django.middleware.gzip import GZipMiddleware +from django.utils.decorators import decorator_from_middleware gzip_page = decorator_from_middleware(GZipMiddleware) gzip_page.__doc__ = "Decorator for views that gzips pages if the client supports it." diff --git a/django/views/decorators/http.py b/django/views/decorators/http.py index 990c3770db..4399182fbd 100644 --- a/django/views/decorators/http.py +++ b/django/views/decorators/http.py @@ -6,10 +6,14 @@ import logging from calendar import timegm from functools import wraps -from django.utils.decorators import decorator_from_middleware, available_attrs -from django.utils.http import http_date, parse_http_date_safe, parse_etags, quote_etag +from django.http import ( + HttpResponse, HttpResponseNotAllowed, HttpResponseNotModified, +) from django.middleware.http import ConditionalGetMiddleware -from django.http import HttpResponseNotAllowed, HttpResponseNotModified, HttpResponse +from django.utils.decorators import available_attrs, decorator_from_middleware +from django.utils.http import ( + http_date, parse_etags, parse_http_date_safe, quote_etag, +) conditional_page = decorator_from_middleware(ConditionalGetMiddleware) diff --git a/django/views/decorators/vary.py b/django/views/decorators/vary.py index 056669278b..df92c65c5c 100644 --- a/django/views/decorators/vary.py +++ b/django/views/decorators/vary.py @@ -1,4 +1,5 @@ from functools import wraps + from django.utils.cache import patch_vary_headers from django.utils.decorators import available_attrs diff --git a/django/views/defaults.py b/django/views/defaults.py index e71756d1dd..35d42830a4 100644 --- a/django/views/defaults.py +++ b/django/views/defaults.py @@ -1,5 +1,5 @@ from django import http -from django.template import loader, Context, Engine, TemplateDoesNotExist +from django.template import Context, Engine, TemplateDoesNotExist, loader from django.views.decorators.csrf import requires_csrf_token diff --git a/django/views/generic/base.py b/django/views/generic/base.py index afbf9bc571..dab074eb83 100644 --- a/django/views/generic/base.py +++ b/django/views/generic/base.py @@ -6,11 +6,11 @@ from functools import update_wrapper from django import http from django.core.exceptions import ImproperlyConfigured -from django.core.urlresolvers import reverse, NoReverseMatch +from django.core.urlresolvers import NoReverseMatch, reverse from django.template.response import TemplateResponse +from django.utils import six from django.utils.decorators import classonlymethod from django.utils.deprecation import RemovedInDjango19Warning -from django.utils import six _sentinel = object() logger = logging.getLogger('django.request') diff --git a/django/views/generic/dates.py b/django/views/generic/dates.py index 27f0ba1065..2a63db2fe9 100644 --- a/django/views/generic/dates.py +++ b/django/views/generic/dates.py @@ -1,17 +1,22 @@ from __future__ import unicode_literals import datetime + from django.conf import settings -from django.db import models from django.core.exceptions import ImproperlyConfigured +from django.db import models from django.http import Http404 +from django.utils import timezone from django.utils.encoding import force_str, force_text from django.utils.functional import cached_property from django.utils.translation import ugettext as _ -from django.utils import timezone from django.views.generic.base import View -from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin -from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin +from django.views.generic.detail import ( + BaseDetailView, SingleObjectTemplateResponseMixin, +) +from django.views.generic.list import ( + MultipleObjectMixin, MultipleObjectTemplateResponseMixin, +) class YearMixin(object): diff --git a/django/views/generic/detail.py b/django/views/generic/detail.py index a40e93a7f5..13649a318b 100644 --- a/django/views/generic/detail.py +++ b/django/views/generic/detail.py @@ -4,7 +4,7 @@ from django.core.exceptions import ImproperlyConfigured from django.db import models from django.http import Http404 from django.utils.translation import ugettext as _ -from django.views.generic.base import TemplateResponseMixin, ContextMixin, View +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View class SingleObjectMixin(ContextMixin): diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py index a4329a25b0..2a2590263f 100644 --- a/django/views/generic/edit.py +++ b/django/views/generic/edit.py @@ -8,9 +8,10 @@ from django.http import HttpResponseRedirect from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_text -from django.views.generic.base import TemplateResponseMixin, ContextMixin, View -from django.views.generic.detail import (SingleObjectMixin, - SingleObjectTemplateResponseMixin, BaseDetailView) +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View +from django.views.generic.detail import ( + BaseDetailView, SingleObjectMixin, SingleObjectTemplateResponseMixin, +) PERCENT_PLACEHOLDER_REGEX = re.compile(r'%\([^\)]+\)') # RemovedInDjango20Warning diff --git a/django/views/generic/list.py b/django/views/generic/list.py index 2243bcec4a..ccb2185524 100644 --- a/django/views/generic/list.py +++ b/django/views/generic/list.py @@ -1,12 +1,12 @@ from __future__ import unicode_literals -from django.core.paginator import Paginator, InvalidPage from django.core.exceptions import ImproperlyConfigured +from django.core.paginator import InvalidPage, Paginator from django.db.models.query import QuerySet from django.http import Http404 from django.utils import six from django.utils.translation import ugettext as _ -from django.views.generic.base import TemplateResponseMixin, ContextMixin, View +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View class MultipleObjectMixin(ContextMixin): diff --git a/django/views/i18n.py b/django/views/i18n.py index 8ec2ccab90..9bb97e147a 100644 --- a/django/views/i18n.py +++ b/django/views/i18n.py @@ -1,18 +1,20 @@ +import gettext as gettext_module import importlib import json import os -import gettext as gettext_module from django import http from django.apps import apps from django.conf import settings from django.template import Context, Template -from django.utils.translation import check_for_language, to_locale, get_language, LANGUAGE_SESSION_KEY -from django.utils.encoding import smart_text -from django.utils.formats import get_format_modules, get_format +from django.utils import six from django.utils._os import upath +from django.utils.encoding import smart_text +from django.utils.formats import get_format, get_format_modules from django.utils.http import is_safe_url -from django.utils import six +from django.utils.translation import ( + LANGUAGE_SESSION_KEY, check_for_language, get_language, to_locale, +) def set_language(request): diff --git a/django/views/static.py b/django/views/static.py index 75e81eccd3..1ff36bc8e9 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -6,13 +6,15 @@ from __future__ import unicode_literals import mimetypes import os -import stat import posixpath import re +import stat -from django.http import (Http404, HttpResponse, HttpResponseRedirect, - HttpResponseNotModified, FileResponse) -from django.template import loader, Template, Context, TemplateDoesNotExist +from django.http import ( + FileResponse, Http404, HttpResponse, HttpResponseNotModified, + HttpResponseRedirect, +) +from django.template import Context, Template, TemplateDoesNotExist, loader from django.utils.http import http_date, parse_http_date from django.utils.six.moves.urllib.parse import unquote from django.utils.translation import ugettext as _, ugettext_lazy |
