Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Second half of little cleanup tweaks suggested by pyflakes.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a926046ba633ac38d3306b6bc10677a670929786 1 parent 5c5ca53
@jacobian jacobian authored
1  django/core/handlers/
@@ -148,7 +148,6 @@ def __call__(self, req):
def populate_apache_request(http_response, mod_python_req):
"Populates the mod_python request object with an HttpResponse"
- from django.conf import settings
mod_python_req.content_type = http_response['Content-Type']
for key, value in http_response.headers.items():
if key != 'Content-Type':
1  django/core/
@@ -692,7 +692,6 @@ def startapp(app_name, directory):
def inspectdb():
"Generator that introspects the tables in the given database name and returns a Django model, one line at a time."
from django.db import connection, get_introspection_module
- from django.conf import settings
import keyword
introspection_module = get_introspection_module()
3  django/db/models/
@@ -4,8 +4,7 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.fields import AutoField, ImageField, FieldDoesNotExist
from django.db.models.fields.related import OneToOneRel, ManyToOneRel
-from django.db.models.related import RelatedObject
-from django.db.models.query import orderlist2sql, delete_objects
+from django.db.models.query import delete_objects
from django.db.models.options import Options, AdminOptions
from django.db import connection, backend, transaction
from django.db.models import signals
2  django/db/models/fields/
@@ -4,7 +4,7 @@
from django.core import validators
from django import forms
from django.core.exceptions import ObjectDoesNotExist
-from django.utils.functional import curry, lazy
+from django.utils.functional import curry
from django.utils.text import capfirst
from django.utils.translation import gettext, gettext_lazy
import datetime, os, time
2  django/db/models/fields/
@@ -1,4 +1,4 @@
-from django.db import backend, connection, transaction
+from django.db import backend, transaction
from django.db.models import signals, get_model
from django.db.models.fields import AutoField, Field, IntegerField, get_ul_class
from django.db.models.related import RelatedObject
3  django/db/models/
@@ -1,10 +1,7 @@
-from django.utils.functional import curry
-from django.db import backend, connection
from django.db.models.query import QuerySet
from django.dispatch import dispatcher
from django.db.models import signals
from django.db.models.fields import FieldDoesNotExist
-from django.utils.datastructures import SortedDict
# Size of each "chunk" for get_iterator calls.
# Larger values are slightly faster at the expense of more storage space.
4 django/db/models/
@@ -5,7 +5,7 @@
from django.dispatch import dispatcher
from django.db.models import signals
from django.utils.functional import curry
-from django.utils.datastructures import DotExpandedDict, MultiValueDict
+from django.utils.datastructures import DotExpandedDict
from django.utils.text import capfirst
import types
@@ -76,7 +76,7 @@ def __init__(self, follow=None):
# Add field for ordering.
if self.change and self.opts.get_ordered_objects():
- self.fields.append(formfields.CommaSeparatedIntegerField(field_name="order_"))
+ self.fields.append(forms.CommaSeparatedIntegerField(field_name="order_"))
def save(self, new_data):
# TODO: big cleanup when core fields go -> use recursive manipulators.
1  django/middleware/
@@ -1,7 +1,6 @@
from django.conf import settings
from django.core.cache import cache
from django.utils.cache import get_cache_key, learn_cache_key, patch_response_headers
-from django.http import HttpResponseNotModified
class CacheMiddleware(object):
1  django/middleware/
@@ -1,4 +1,3 @@
-from django.conf import settings
from django.db import transaction
class TransactionMiddleware(object):
2  django/template/
@@ -817,7 +817,7 @@ def dec(func):
self.filters[name] = filter_func
return filter_func
- raise InvalidTemplateLibrary, "Unsupported arguments to Library.filter: (%r, %r, %r)", (name, compile_function, has_arg)
+ raise InvalidTemplateLibrary, "Unsupported arguments to Library.filter: (%r, %r)", (name, filter_func)
def filter_function(self, func):
self.filters[func.__name__] = func
2  django/template/
@@ -21,7 +21,7 @@
# installed, because pkg_resources is necessary to read eggs.
from django.core.exceptions import ImproperlyConfigured
-from django.template import Origin, StringOrigin, Template, Context, TemplateDoesNotExist, add_to_builtins
+from django.template import Origin, Template, Context, TemplateDoesNotExist, add_to_builtins
from django.conf import settings
template_source_loaders = None
2  django/template/
@@ -1,5 +1,5 @@
from django.template import TemplateSyntaxError, TemplateDoesNotExist, resolve_variable
-from django.template import Library, Context, Node
+from django.template import Library, Node
from django.template.loader import get_template, get_template_from_string, find_template_source
from django.conf import settings
7 django/templatetags/
@@ -1,8 +1,7 @@
-from django.template import Node, NodeList, Template, Context, resolve_variable
+from django.template import Node, resolve_variable
from django.template import TemplateSyntaxError, TokenParser, Library
-from django.template import TOKEN_BLOCK, TOKEN_TEXT, TOKEN_VAR
+from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
-import re, sys
register = Library()
@@ -228,7 +227,7 @@ def top(self):
if countervar and counter:
if token.contents.strip() != 'plural':
- raise TemplateSyntaxError, "'blocktrans' doesn't allow other block tags inside it" % tag
+ raise TemplateSyntaxError, "'blocktrans' doesn't allow other block tags inside it"
while parser.tokens:
token = parser.next_token()
if token.token_type in (TOKEN_VAR, TOKEN_TEXT):
2  django/utils/
@@ -2,8 +2,6 @@
-import types
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
2  django/views/
@@ -3,8 +3,6 @@
from django.utils.html import escape
from django.http import HttpResponseServerError, HttpResponseNotFound
import os, re
-from itertools import count, izip
-from os.path import dirname, join as pathjoin
1  django/views/decorators/
@@ -10,7 +10,6 @@
Additionally, all headers from the response's Vary header will be taken into
account on caching -- just like the middleware does.
-import re
from django.utils.decorators import decorator_from_middleware
from django.utils.cache import patch_cache_control, add_never_cache_headers
3  django/views/generic/
@@ -4,8 +4,7 @@
from django.db.models import FileField
from django.contrib.auth.views import redirect_to_login
from django.template import RequestContext
-from django.core.paginator import ObjectPaginator, InvalidPage
-from django.http import Http404, HttpResponse, HttpResponseRedirect
+from django.http import Http404, HttpResponseRedirect
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
def create_object(request, model, template_name=None,
1  django/views/
@@ -1,5 +1,4 @@
from django.template import loader
-from django.core.exceptions import ImproperlyConfigured
from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified
from django.template import Template, Context, TemplateDoesNotExist
import mimetypes
Please sign in to comment.
Something went wrong with that request. Please try again.