Fixed #6481 -- Fixed a bunch of import problems (and some whitespace cleanups).

Found by Bastian Kleineidam with help from pyflakes. Thanks.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-02-19 00:08:08 +00:00
parent 3eec925f73
commit f1a24be01c
18 changed files with 41 additions and 69 deletions

View File

@ -5,7 +5,7 @@ from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.utils.translation import ugettext_lazy, ugettext as _ from django.utils.translation import ugettext_lazy, ugettext as _
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
import base64, datetime, md5 import base64, md5
import cPickle as pickle import cPickle as pickle
ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.") ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")

View File

@ -8,8 +8,6 @@ from django.utils.translation import get_date_formats
from django.utils.encoding import force_unicode from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.views.generic import date_based from django.views.generic import date_based
import datetime
import time
class CalendarPlugin(DatabrowsePlugin): class CalendarPlugin(DatabrowsePlugin):
def __init__(self, field_names=None): def __init__(self, field_names=None):

View File

@ -7,8 +7,6 @@ from django.utils.text import capfirst
from django.utils.encoding import smart_str, force_unicode from django.utils.encoding import smart_str, force_unicode
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.views.generic import date_based from django.views.generic import date_based
import datetime
import time
import urllib import urllib
class FieldChoicePlugin(DatabrowsePlugin): class FieldChoicePlugin(DatabrowsePlugin):

View File

@ -2,8 +2,6 @@ from django.db.models import FieldDoesNotExist, DateTimeField
from django.http import Http404 from django.http import Http404
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.contrib.databrowse.datastructures import EasyModel, EasyChoice from django.contrib.databrowse.datastructures import EasyModel, EasyChoice
import datetime
import time
########### ###########
# CHOICES # # CHOICES #

View File

@ -3,7 +3,6 @@ Formtools Preview application.
""" """
from django.conf import settings from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404 from django.http import Http404
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.template.context import RequestContext from django.template.context import RequestContext

View File

@ -3,8 +3,6 @@ from django.contrib.formtools import preview
from django import http from django import http
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import TestCase
from django.test.client import Client
success_string = "Done was called!" success_string = "Done was called!"
test_data = {'field1': u'foo', test_data = {'field1': u'foo',
@ -88,6 +86,3 @@ class PreviewTests(TestCase):
response = self.client.post('/test1/', test_data) response = self.client.post('/test1/', test_data)
self.assertEqual(response.content, success_string) self.assertEqual(response.content, success_string)
if __name__ == '__main__':
unittest.main()

View File

@ -2,8 +2,7 @@ from django.utils.translation import ungettext, ugettext as _
from django.utils.encoding import force_unicode from django.utils.encoding import force_unicode
from django import template from django import template
from django.template import defaultfilters from django.template import defaultfilters
from django.conf import settings from datetime import date
from datetime import date, timedelta
import re import re
register = template.Library() register = template.Library()

View File

@ -7,7 +7,6 @@ from django.newforms import ValidationError
from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext from django.utils.translation import ugettext
import re
class ARProvinceSelect(Select): class ARProvinceSelect(Select):
""" """

View File

@ -1,38 +1,38 @@
from django import newforms as forms from django import newforms as forms
DEFAULT_DATE_INPUT_FORMATS = ( DEFAULT_DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06' '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006' '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
) )
DEFAULT_DATETIME_INPUT_FORMATS = ( DEFAULT_DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30' '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%Y-%m-%d', # '2006-10-25' '%Y-%m-%d', # '2006-10-25'
'%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59'
'%d/%m/%Y %H:%M', # '25/10/2006 14:30' '%d/%m/%Y %H:%M', # '25/10/2006 14:30'
'%d/%m/%Y', # '25/10/2006' '%d/%m/%Y', # '25/10/2006'
'%d/%m/%y %H:%M:%S', # '25/10/06 14:30:59' '%d/%m/%y %H:%M:%S', # '25/10/06 14:30:59'
'%d/%m/%y %H:%M', # '25/10/06 14:30' '%d/%m/%y %H:%M', # '25/10/06 14:30'
'%d/%m/%y', # '25/10/06' '%d/%m/%y', # '25/10/06'
) )
class DateField(forms.DateField): class DateField(forms.DateField):
""" """
A date input field which uses non-US date input formats by default. A date input field which uses non-US date input formats by default.
""" """
def __init__(self, input_formats=None, *args, **kwargs): def __init__(self, input_formats=None, *args, **kwargs):
input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
super(DateField, self).__init__(input_formats=input_formats, *args, **kwargs) super(DateField, self).__init__(input_formats=input_formats, *args, **kwargs)
class DateTimeField(forms.DateTimeField): class DateTimeField(forms.DateTimeField):
""" """
A date and time input field which uses non-US date and time input formats A date and time input field which uses non-US date and time input formats
by default. by default.
""" """
def __init__(self, input_formats=None, *args, **kwargs): def __init__(self, input_formats=None, *args, **kwargs):
input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
super(DateTimeField, self).__init__(input_formats=input_formats, *args, **kwargs) super(DateTimeField, self).__init__(input_formats=input_formats, *args, **kwargs)

View File

@ -7,8 +7,6 @@ from django.newforms import ValidationError
from django.utils.translation import ugettext from django.utils.translation import ugettext
from django.newforms.fields import RegexField, Select from django.newforms.fields import RegexField, Select
import re
class JPPostalCodeField(RegexField): class JPPostalCodeField(RegexField):
""" """
A form field that validates its input is a Japanese postcode. A form field that validates its input is a Japanese postcode.

View File

@ -1,10 +1,5 @@
import os
import sys
import time
import datetime
import base64 import base64
import md5 import md5
import random
import cPickle as pickle import cPickle as pickle
from django.db import models from django.db import models

View File

@ -14,7 +14,6 @@ u'lorem ipsum dolor'
""" """
from django.contrib.webdesign.lorem_ipsum import * from django.contrib.webdesign.lorem_ipsum import *
import datetime
if __name__ == '__main__': if __name__ == '__main__':
import doctest import doctest

View File

@ -4,7 +4,6 @@ Serialize data to/from JSON
import datetime import datetime
from django.utils import simplejson from django.utils import simplejson
from django.utils.simplejson import decoder
from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer from django.core.serializers.python import Deserializer as PythonDeserializer
try: try:

View File

@ -4,7 +4,6 @@ YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__. Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
""" """
import datetime
from django.db import models from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer from django.core.serializers.python import Deserializer as PythonDeserializer

View File

@ -21,7 +21,6 @@ if (version < (1,2,1) or (version[:3] == (1, 2, 1) and
from MySQLdb.converters import conversions from MySQLdb.converters import conversions
from MySQLdb.constants import FIELD_TYPE from MySQLdb.constants import FIELD_TYPE
import types
import re import re
# Raise exceptions for database warnings if DEBUG is on # Raise exceptions for database warnings if DEBUG is on

View File

@ -100,7 +100,7 @@ __all__ = [
import __future__ import __future__
import sys, traceback, inspect, linecache, os, re, types import sys, traceback, inspect, linecache, os, re
import unittest, difflib, pdb, tempfile import unittest, difflib, pdb, tempfile
import warnings import warnings
from StringIO import StringIO from StringIO import StringIO

View File

@ -1,7 +1,5 @@
import datetime
import sys import sys
from cStringIO import StringIO from cStringIO import StringIO
from urlparse import urlparse
from django.conf import settings from django.conf import settings
from django.contrib.auth import authenticate, login from django.contrib.auth import authenticate, login
from django.core.handlers.base import BaseHandler from django.core.handlers.base import BaseHandler

View File

@ -146,4 +146,3 @@ def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
teardown_test_environment() teardown_test_environment()
return len(result.failures) + len(result.errors) return len(result.failures) + len(result.errors)