mirror of https://github.com/django/django.git
Fixed a bunch of spurious imports, typos, and other small errors turned up by a pass through PyFlakes. This covers about the first third of the errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e9a236d86c
commit
17d0bd1512
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import getopt
|
|
||||||
|
|
||||||
def compile_messages():
|
def compile_messages():
|
||||||
basedir = None
|
basedir = None
|
||||||
|
|
|
@ -7,7 +7,6 @@ a list of all possible variables.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from django.conf import global_settings
|
from django.conf import global_settings
|
||||||
|
|
||||||
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
|
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
from django import template
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.admin.views.main import MAX_SHOW_ALL_ALLOWED, ALL_VAR
|
from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
|
||||||
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
|
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
|
||||||
from django.contrib.admin.views.main import IS_POPUP_VAR, EMPTY_CHANGELIST_VALUE
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import dateformat
|
from django.utils import dateformat
|
||||||
|
@ -119,7 +117,7 @@ def items_for_result(cl, result):
|
||||||
if callable(attr):
|
if callable(attr):
|
||||||
attr = attr()
|
attr = attr()
|
||||||
result_repr = str(attr)
|
result_repr = str(attr)
|
||||||
except AttributeError, ObjectDoesNotExist:
|
except (AttributeError, ObjectDoesNotExist):
|
||||||
result_repr = EMPTY_CHANGELIST_VALUE
|
result_repr = EMPTY_CHANGELIST_VALUE
|
||||||
else:
|
else:
|
||||||
# Strip HTML tags in the resulting text, except if the
|
# Strip HTML tags in the resulting text, except if the
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
from django import template
|
from django import template
|
||||||
from django.contrib.admin.views.main import AdminBoundField
|
from django.contrib.admin.views.main import AdminBoundField
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from django.utils.html import escape
|
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.utils.functional import curry
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.fields import Field
|
from django.db.models.fields import Field
|
||||||
from django.db.models.related import BoundRelatedObject
|
from django.db.models.related import BoundRelatedObject
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
import re
|
import re
|
||||||
from email.Parser import HeaderParser
|
from email.Parser import HeaderParser
|
||||||
from email.Errors import HeaderParseError
|
from email.Errors import HeaderParseError
|
||||||
from urlparse import urljoin
|
|
||||||
try:
|
try:
|
||||||
import docutils.core
|
import docutils.core
|
||||||
import docutils.nodes
|
import docutils.nodes
|
||||||
|
|
|
@ -10,9 +10,6 @@ from django.shortcuts import get_object_or_404, render_to_response
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.query import handle_legacy_orderlist, QuerySet
|
from django.db.models.query import handle_legacy_orderlist, QuerySet
|
||||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||||
from django.template import loader
|
|
||||||
from django.utils import dateformat
|
|
||||||
from django.utils.dates import MONTHS
|
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.text import capfirst, get_text_list
|
from django.utils.text import capfirst, get_text_list
|
||||||
import operator
|
import operator
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.contrib.auth.models import User, check_password
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
class ModelBackend:
|
class ModelBackend:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django import forms
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME
|
from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.comments.models import Comment, FreeComment
|
from django.contrib.comments.models import Comment, FreeComment
|
||||||
from django.contrib.syndication.feeds import Feed
|
from django.contrib.syndication.feeds import Feed
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
|
|
||||||
class LatestFreeCommentsFeed(Feed):
|
class LatestFreeCommentsFeed(Feed):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.http import Http404
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.contrib.comments.models import Comment, FreeComment, PHOTOS_REQUIRED, PHOTOS_OPTIONAL, RATINGS_REQUIRED, RATINGS_OPTIONAL, IS_PUBLIC
|
from django.contrib.comments.models import Comment, FreeComment, RATINGS_REQUIRED, RATINGS_OPTIONAL, IS_PUBLIC
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.auth.forms import AuthenticationForm
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"Database cache backend."
|
"Database cache backend."
|
||||||
|
|
||||||
from django.core.cache.backends.base import BaseCache
|
from django.core.cache.backends.base import BaseCache
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction, DatabaseError
|
||||||
import base64, time
|
import base64, time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
from django.core.cache.backends.simple import CacheClass as SimpleCacheClass
|
from django.core.cache.backends.simple import CacheClass as SimpleCacheClass
|
||||||
from django.utils.synch import RWLock
|
from django.utils.synch import RWLock
|
||||||
import copy, time
|
import copy, time
|
||||||
try:
|
|
||||||
import cPickle as pickle
|
|
||||||
except ImportError:
|
|
||||||
import pickle
|
|
||||||
|
|
||||||
class CacheClass(SimpleCacheClass):
|
class CacheClass(SimpleCacheClass):
|
||||||
def __init__(self, host, params):
|
def __init__(self, host, params):
|
||||||
|
|
|
@ -119,7 +119,6 @@ class BaseHandler(object):
|
||||||
Returns an HttpResponse that displays a PUBLIC error message for a
|
Returns an HttpResponse that displays a PUBLIC error message for a
|
||||||
fundamental error.
|
fundamental error.
|
||||||
"""
|
"""
|
||||||
from django.core import urlresolvers
|
|
||||||
callback, param_dict = resolver.resolve500()
|
callback, param_dict = resolver.resolve500()
|
||||||
return callback(request, **param_dict)
|
return callback(request, **param_dict)
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ class WSGIRequest(http.HttpRequest):
|
||||||
self.method = environ['REQUEST_METHOD'].upper()
|
self.method = environ['REQUEST_METHOD'].upper()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
from pprint import pformat
|
|
||||||
return '<WSGIRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \
|
return '<WSGIRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \
|
||||||
(pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
|
(pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
|
||||||
pformat(self.META))
|
pformat(self.META))
|
||||||
|
|
|
@ -593,7 +593,6 @@ install.args = APP_ARGS
|
||||||
def reset(app):
|
def reset(app):
|
||||||
"Executes the equivalent of 'get_sql_reset' in the current database."
|
"Executes the equivalent of 'get_sql_reset' in the current database."
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction
|
||||||
from cStringIO import StringIO
|
|
||||||
app_name = app.__name__.split('.')[-2]
|
app_name = app.__name__.split('.')[-2]
|
||||||
|
|
||||||
disable_termcolors()
|
disable_termcolors()
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from copy import copy
|
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
class InvalidPage(Exception):
|
class InvalidPage(Exception):
|
||||||
|
|
|
@ -79,7 +79,7 @@ def Deserializer(object_list, **options):
|
||||||
elif field.rel and isinstance(field.rel, models.ManyToOneRel):
|
elif field.rel and isinstance(field.rel, models.ManyToOneRel):
|
||||||
try:
|
try:
|
||||||
data[field.name] = field.rel.to._default_manager.get(pk=field_value)
|
data[field.name] = field.rel.to._default_manager.get(pk=field_value)
|
||||||
except RelatedModel.DoesNotExist:
|
except field.rel.to.DoesNotExist:
|
||||||
data[field.name] = None
|
data[field.name] = None
|
||||||
|
|
||||||
# Handle all other fields
|
# Handle all other fields
|
||||||
|
|
|
@ -8,7 +8,7 @@ been reviewed for security issues. Don't use it for production use.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||||
from types import ListType, StringType, TupleType
|
from types import ListType, StringType
|
||||||
import os, re, sys, time, urllib
|
import os, re, sys, time, urllib
|
||||||
|
|
||||||
__version__ = "0.1"
|
__version__ = "0.1"
|
||||||
|
|
|
@ -40,7 +40,7 @@ class MysqlDebugWrapper:
|
||||||
def executemany(self, sql, param_list):
|
def executemany(self, sql, param_list):
|
||||||
try:
|
try:
|
||||||
return self.cursor.executemany(sql, param_list)
|
return self.cursor.executemany(sql, param_list)
|
||||||
except Database.Warning:
|
except Database.Warning, w:
|
||||||
self.cursor.execute("SHOW WARNINGS")
|
self.cursor.execute("SHOW WARNINGS")
|
||||||
raise Database.Warning, "%s: %s" % (w, self.cursor.fetchall())
|
raise Database.Warning, "%s: %s" % (w, self.cursor.fetchall())
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from django.db import transaction
|
|
||||||
from django.db.backends.mysql.base import quote_name
|
from django.db.backends.mysql.base import quote_name
|
||||||
from MySQLdb import ProgrammingError, OperationalError
|
from MySQLdb import ProgrammingError, OperationalError
|
||||||
from MySQLdb.constants import FIELD_TYPE
|
from MySQLdb.constants import FIELD_TYPE
|
||||||
|
|
|
@ -10,7 +10,6 @@ try:
|
||||||
except ImportError, e:
|
except ImportError, e:
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
raise ImproperlyConfigured, "Error loading cx_Oracle module: %s" % e
|
raise ImproperlyConfigured, "Error loading cx_Oracle module: %s" % e
|
||||||
import types
|
|
||||||
|
|
||||||
DatabaseError = Database.Error
|
DatabaseError = Database.Error
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from django.db import transaction
|
|
||||||
from django.db.backends.oracle.base import quote_name
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
|
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from django.db import transaction
|
|
||||||
from django.db.backends.postgresql.base import quote_name
|
from django.db.backends.postgresql.base import quote_name
|
||||||
|
|
||||||
def get_table_list(cursor):
|
def get_table_list(cursor):
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from django.db import transaction
|
|
||||||
from django.db.backends.postgresql_psycopg2.base import quote_name
|
from django.db.backends.postgresql_psycopg2.base import quote_name
|
||||||
|
|
||||||
def get_table_list(cursor):
|
def get_table_list(cursor):
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from django.db import transaction
|
|
||||||
from django.db.backends.sqlite3.base import quote_name
|
from django.db.backends.sqlite3.base import quote_name
|
||||||
|
|
||||||
def get_table_list(cursor):
|
def get_table_list(cursor):
|
||||||
|
|
Loading…
Reference in New Issue