Second half of little cleanup tweaks suggested by pyflakes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3414 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2006-07-21 20:39:17 +00:00
parent 5c5ca53b70
commit a926046ba6
18 changed files with 12 additions and 28 deletions

View File

@ -148,7 +148,6 @@ class ModPythonHandler(BaseHandler):
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':

View File

@ -692,7 +692,6 @@ startapp.args = "[appname]"
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()

View File

@ -4,8 +4,7 @@ from django.core import validators
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

View File

@ -4,7 +4,7 @@ from django.conf import settings
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

View File

@ -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

View File

@ -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.

View File

@ -5,7 +5,7 @@ from django.db.models.fields import FileField, AutoField
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 @@ class AutomaticManipulator(forms.Manipulator):
# 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.

View File

@ -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):
"""

View File

@ -1,4 +1,3 @@
from django.conf import settings
from django.db import transaction
class TransactionMiddleware(object):

View File

@ -817,7 +817,7 @@ class Library(object):
self.filters[name] = filter_func
return filter_func
else:
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

View File

@ -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

View File

@ -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

View File

@ -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 do_block_translate(parser, token):
break
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):

View File

@ -2,8 +2,6 @@
termcolors.py
"""
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)])

View File

@ -3,8 +3,6 @@ from django.template import Template, Context, TemplateDoesNotExist
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
HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD')

View File

@ -10,7 +10,6 @@ example, as that is unique across a Django project.
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

View File

@ -4,8 +4,7 @@ from django import forms
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,

View File

@ -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