Fixed #7847 -- Removed a whole bunch of unused imports from throughout the codebase. Thanks, julien
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
cf2a05952e
commit
29f0e8182f
|
@ -1,5 +1,4 @@
|
|||
from django import oldforms, template
|
||||
from django import forms
|
||||
from django import forms, template
|
||||
from django.forms.formsets import all_valid
|
||||
from django.forms.models import modelform_factory, inlineformset_factory
|
||||
from django.forms.models import BaseInlineFormset
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.db import models
|
|||
from django.db.models.query import QuerySet
|
||||
from django.utils.encoding import force_unicode, smart_str
|
||||
from django.utils.translation import ugettext
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.http import urlencode
|
||||
import operator
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ import copy
|
|||
from django import forms
|
||||
from django.forms.widgets import RadioFieldRenderer
|
||||
from django.forms.util import flatatt
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.text import capfirst, truncate_words
|
||||
from django.utils.text import truncate_words
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.encoding import force_unicode
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.contrib.admin.views.decorators import staff_member_required
|
|||
from django.db import models
|
||||
from django.shortcuts import render_to_response
|
||||
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
|
||||
from django.http import Http404, get_host
|
||||
from django.http import Http404
|
||||
from django.core import urlresolvers
|
||||
from django.contrib.admindocs import utils
|
||||
from django.contrib.sites.models import Site
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.contrib.auth.models import User, Group
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django import oldforms, template
|
||||
from django import template
|
||||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
try:
|
||||
from functools import wraps, update_wrapper
|
||||
from functools import update_wrapper
|
||||
except ImportError:
|
||||
from django.utils.functional import wraps, update_wrapper # Python 2.3, 2.4 fallback.
|
||||
from django.utils.functional import update_wrapper # Python 2.3, 2.4 fallback.
|
||||
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
from django.http import HttpResponseRedirect
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.contrib.auth.models import User
|
|||
from django.contrib.auth import authenticate
|
||||
from django.contrib.sites.models import Site
|
||||
from django.template import Context, loader
|
||||
from django.core import validators
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import os
|
|||
import re
|
||||
import sys
|
||||
from optparse import make_option
|
||||
from django.contrib.auth.models import User, UNUSABLE_PASSWORD
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import validators
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ from django.contrib.databrowse.datastructures import EasyModel
|
|||
from django.contrib.databrowse.sites import DatabrowsePlugin
|
||||
from django.shortcuts import render_to_response
|
||||
from django.utils.text import capfirst
|
||||
from django.utils.translation import get_date_formats
|
||||
from django.utils.encoding import force_unicode
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.views.generic import date_based
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.shortcuts import render_to_response
|
|||
from django.utils.text import capfirst
|
||||
from django.utils.encoding import smart_str, force_unicode
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.views.generic import date_based
|
||||
import urllib
|
||||
|
||||
class FieldChoicePlugin(DatabrowsePlugin):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django import http
|
||||
from django.db import models
|
||||
from django.contrib.databrowse.datastructures import EasyModel, EasyChoice
|
||||
from django.contrib.databrowse.datastructures import EasyModel
|
||||
from django.shortcuts import render_to_response
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from django.db.models import FieldDoesNotExist, DateTimeField
|
||||
from django.http import Http404
|
||||
from django.shortcuts import render_to_response
|
||||
from django.contrib.databrowse.datastructures import EasyModel, EasyChoice
|
||||
|
||||
###########
|
||||
# CHOICES #
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django import forms
|
||||
from django.contrib.formtools import preview
|
||||
from django import http
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
|
||||
success_string = "Done was called!"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from django.conf import settings
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.core.cache import cache
|
||||
|
||||
|
||||
class SessionStore(SessionBase):
|
||||
"""
|
||||
A cache-based session store.
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sessions.models import Session
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.core.exceptions import SuspiciousOperation
|
||||
|
||||
|
||||
class SessionStore(SessionBase):
|
||||
"""
|
||||
Implements database session store.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
|
||||
from django.template import Context, loader, Template, TemplateDoesNotExist
|
||||
from django.template import loader, Template, TemplateDoesNotExist
|
||||
from django.contrib.sites.models import Site, RequestSite
|
||||
from django.utils import feedgenerator
|
||||
from django.utils.encoding import smart_unicode, iri_to_uri
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""
|
||||
Base file upload handler classes, and the built-in concrete subclasses
|
||||
"""
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
|
|
|
@ -2,7 +2,6 @@ import os
|
|||
import sys
|
||||
from optparse import make_option
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.core.management.color import no_style
|
||||
|
||||
try:
|
||||
set
|
||||
|
|
|
@ -17,7 +17,6 @@ class Command(BaseCommand):
|
|||
|
||||
def handle(self, *test_labels, **options):
|
||||
from django.conf import settings
|
||||
from django.db.models import get_app, get_apps
|
||||
|
||||
verbosity = int(options.get('verbosity', 1))
|
||||
interactive = options.get('interactive', True)
|
||||
|
|
|
@ -17,7 +17,6 @@ class Command(BaseCommand):
|
|||
requires_model_validation = False
|
||||
|
||||
def handle(self, *fixture_labels, **options):
|
||||
from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
from django.test.utils import create_test_db
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import os
|
|||
|
||||
from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, BaseDatabaseOperations, util
|
||||
from django.db.backends.oracle import query
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.utils.encoding import smart_str, force_unicode
|
||||
|
||||
# Oracle takes client-side character set encoding from the environment.
|
||||
|
|
|
@ -10,8 +10,6 @@ from django.db.models.fields import *
|
|||
from django.db.models.fields.subclassing import SubfieldBase
|
||||
from django.db.models.fields.related import ForeignKey, OneToOneField, ManyToManyField, ManyToOneRel, ManyToManyRel, OneToOneRel, TABULAR, STACKED
|
||||
from django.db.models import signals
|
||||
from django.utils.functional import curry
|
||||
from django.utils.text import capfirst
|
||||
|
||||
# Admin stages.
|
||||
ADD, CHANGE, BOTH = 1, 2, 3
|
||||
|
|
|
@ -12,7 +12,7 @@ import django.db.models.manipulators # Imported to register signal handler.
|
|||
import django.db.models.manager # Ditto.
|
||||
from django.core import validators
|
||||
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError
|
||||
from django.db.models.fields import AutoField, ImageField, FieldDoesNotExist
|
||||
from django.db.models.fields import AutoField, ImageField
|
||||
from django.db.models.fields.related import OneToOneRel, ManyToOneRel, OneToOneField
|
||||
from django.db.models.query import delete_objects, Q, CollectedObjects
|
||||
from django.db.models.options import Options
|
||||
|
@ -20,7 +20,6 @@ from django.db import connection, transaction
|
|||
from django.db.models import signals
|
||||
from django.db.models.loading import register_models, get_model
|
||||
from django.dispatch import dispatcher
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.utils.functional import curry
|
||||
from django.utils.encoding import smart_str, force_unicode, smart_unicode
|
||||
from django.core.files.move import file_move_safe
|
||||
|
|
|
@ -4,10 +4,8 @@ from django.db.models.fields import AutoField, Field, IntegerField, PositiveInte
|
|||
from django.db.models.related import RelatedObject
|
||||
from django.db.models.query import QuerySet
|
||||
from django.db.models.query_utils import QueryWrapper
|
||||
from django.utils.text import capfirst
|
||||
from django.utils.translation import ugettext_lazy, string_concat, ungettext, ugettext as _
|
||||
from django.utils.functional import curry
|
||||
from django.utils.encoding import smart_unicode
|
||||
from django.core import validators
|
||||
from django import oldforms
|
||||
from django import forms
|
||||
|
|
|
@ -7,7 +7,6 @@ databases). The abstraction barrier only works one way: this module has to know
|
|||
all about the internals of models in order to get the information it needs.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from copy import deepcopy
|
||||
|
||||
from django.utils.tree import Node
|
||||
|
|
|
@ -25,7 +25,7 @@ Internal attributes:
|
|||
deletion, (considerably speeds up the cleanup process
|
||||
vs. the original code.)
|
||||
"""
|
||||
import types, weakref
|
||||
import weakref
|
||||
from django.dispatch import saferef, robustapply, errors
|
||||
|
||||
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
||||
|
@ -129,7 +129,7 @@ def connect(receiver, signal=Any, sender=Any, weak=True):
|
|||
"""
|
||||
if signal is None:
|
||||
raise errors.DispatcherTypeError(
|
||||
'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
|
||||
'Signal cannot be None (receiver=%r sender=%r)' % (receiver, sender)
|
||||
)
|
||||
if weak:
|
||||
receiver = saferef.safeRef(receiver, onDelete=_removeReceiver)
|
||||
|
@ -159,7 +159,7 @@ def connect(receiver, signal=Any, sender=Any, weak=True):
|
|||
else:
|
||||
receivers = signals[signal] = []
|
||||
try:
|
||||
current = sendersBack.get( receiverID )
|
||||
current = sendersBack.get(receiverID)
|
||||
if current is None:
|
||||
sendersBack[ receiverID ] = current = []
|
||||
if senderkey not in current:
|
||||
|
@ -199,7 +199,7 @@ def disconnect(receiver, signal=Any, sender=Any, weak=True):
|
|||
"""
|
||||
if signal is None:
|
||||
raise errors.DispatcherTypeError(
|
||||
'Signal cannot be None (receiver=%r sender=%r)'%( receiver,sender)
|
||||
'Signal cannot be None (receiver=%r sender=%r)' % (receiver, sender)
|
||||
)
|
||||
if weak: receiver = saferef.safeRef(receiver)
|
||||
senderkey = id(sender)
|
||||
|
@ -226,7 +226,7 @@ def disconnect(receiver, signal=Any, sender=Any, weak=True):
|
|||
)
|
||||
_cleanupConnections(senderkey, signal)
|
||||
|
||||
def getReceivers( sender = Any, signal = Any ):
|
||||
def getReceivers(sender=Any, signal=Any):
|
||||
"""Get list of receivers from global tables
|
||||
|
||||
This utility function allows you to retrieve the
|
||||
|
@ -240,7 +240,7 @@ def getReceivers( sender = Any, signal = Any ):
|
|||
rather than, for instance a list to which you
|
||||
might append new records.
|
||||
|
||||
Normally you would use liveReceivers( getReceivers( ...))
|
||||
Normally you would use liveReceivers(getReceivers(...))
|
||||
to retrieve the actual receiver objects as an iterable
|
||||
object.
|
||||
"""
|
||||
|
@ -258,7 +258,7 @@ def liveReceivers(receivers):
|
|||
receivers.
|
||||
"""
|
||||
for receiver in receivers:
|
||||
if isinstance( receiver, WEAKREF_TYPES):
|
||||
if isinstance(receiver, WEAKREF_TYPES):
|
||||
# Dereference the weak reference.
|
||||
receiver = receiver()
|
||||
if receiver is not None:
|
||||
|
@ -268,7 +268,7 @@ def liveReceivers(receivers):
|
|||
|
||||
|
||||
|
||||
def getAllReceivers( sender = Any, signal = Any ):
|
||||
def getAllReceivers(sender=Any, signal=Any):
|
||||
"""Get list of all receivers from global tables
|
||||
|
||||
This gets all dereferenced receivers which should receive
|
||||
|
@ -363,7 +363,7 @@ def send(signal=Any, sender=Anonymous, *arguments, **named):
|
|||
return responses
|
||||
|
||||
|
||||
def sendExact( signal=Any, sender=Anonymous, *arguments, **named ):
|
||||
def sendExact(signal=Any, sender=Anonymous, *arguments, **named ):
|
||||
"""Send signal only to those receivers registered for exact message
|
||||
|
||||
sendExact allows for avoiding Any/Anonymous registered
|
||||
|
@ -403,7 +403,7 @@ def _removeReceiver(receiver):
|
|||
pass
|
||||
else:
|
||||
try:
|
||||
receivers.remove( receiver )
|
||||
receivers.remove(receiver)
|
||||
except Exception, err:
|
||||
pass
|
||||
_cleanupConnections(senderkey, signal)
|
||||
|
@ -439,11 +439,11 @@ def _removeSender(senderkey):
|
|||
senders.pop(senderkey, None)
|
||||
|
||||
|
||||
def _removeBackrefs( senderkey):
|
||||
def _removeBackrefs(senderkey):
|
||||
"""Remove all back-references to this senderkey"""
|
||||
for receiver_list in connections.pop(senderkey, {}).values():
|
||||
for receiver in receiver_list:
|
||||
_killBackref( receiver, senderkey )
|
||||
_killBackref(receiver, senderkey)
|
||||
|
||||
|
||||
def _removeOldBackRefs(senderkey, signal, receiver, receivers):
|
||||
|
@ -473,18 +473,18 @@ def _removeOldBackRefs(senderkey, signal, receiver, receivers):
|
|||
found = 1
|
||||
break
|
||||
if not found:
|
||||
_killBackref( oldReceiver, senderkey )
|
||||
_killBackref(oldReceiver, senderkey)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _killBackref( receiver, senderkey ):
|
||||
def _killBackref(receiver, senderkey):
|
||||
"""Do the actual removal of back reference from receiver to senderkey"""
|
||||
receiverkey = id(receiver)
|
||||
receivers_list = sendersBack.get( receiverkey, () )
|
||||
receivers_list = sendersBack.get(receiverkey, ())
|
||||
while senderkey in receivers_list:
|
||||
try:
|
||||
receivers_list.remove( senderkey )
|
||||
receivers_list.remove(senderkey)
|
||||
except:
|
||||
break
|
||||
if not receivers_list:
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Refactored "safe reference" from dispatcher.py"""
|
||||
import weakref, traceback
|
||||
from django.utils.functional import curry
|
||||
|
||||
def safeRef(target, onDelete = None):
|
||||
"""Return a *safe* weak reference to a callable target
|
||||
|
|
|
@ -23,7 +23,7 @@ except NameError:
|
|||
from sets import Set as set
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.encoding import StrAndUnicode, smart_unicode, smart_str
|
||||
from django.utils.encoding import smart_unicode, smart_str
|
||||
|
||||
from util import ErrorList, ValidationError
|
||||
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateTimeInput
|
||||
|
|
|
@ -2,7 +2,7 @@ from forms import Form
|
|||
from django.utils.encoding import StrAndUnicode
|
||||
from django.utils.safestring import mark_safe
|
||||
from fields import IntegerField, BooleanField
|
||||
from widgets import Media, HiddenInput, TextInput
|
||||
from widgets import Media, HiddenInput
|
||||
from util import ErrorList, ValidationError
|
||||
|
||||
__all__ = ('BaseFormSet', 'all_valid')
|
||||
|
|
|
@ -8,7 +8,6 @@ from warnings import warn
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.encoding import smart_unicode
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
from util import ValidationError, ErrorList
|
||||
from forms import BaseForm, get_declared_fields
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.utils.html import escape
|
||||
from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode
|
||||
from django.utils.functional import Promise
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
def flatatt(attrs):
|
||||
|
|
|
@ -13,7 +13,7 @@ Usage:
|
|||
|
||||
from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR
|
||||
from django.utils.tzinfo import LocalTimezone
|
||||
from django.utils.translation import string_concat, ugettext as _
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.encoding import force_unicode
|
||||
from calendar import isleap, monthrange
|
||||
import re, time
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import types
|
||||
import urllib
|
||||
import datetime
|
||||
|
||||
from django.utils.functional import Promise
|
||||
from django.utils.safestring import SafeData, mark_safe
|
||||
|
||||
class DjangoUnicodeDecodeError(UnicodeDecodeError):
|
||||
def __init__(self, obj, *args):
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from django.shortcuts import render_to_response
|
||||
from django.template import loader, RequestContext
|
||||
from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
|
||||
|
||||
|
|
Loading…
Reference in New Issue