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:
parent
3eec925f73
commit
f1a24be01c
|
@ -5,7 +5,7 @@ from django.contrib.auth import authenticate, login
|
|||
from django.shortcuts import render_to_response
|
||||
from django.utils.translation import ugettext_lazy, ugettext as _
|
||||
from django.utils.safestring import mark_safe
|
||||
import base64, datetime, md5
|
||||
import base64, md5
|
||||
import cPickle as pickle
|
||||
|
||||
ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")
|
||||
|
|
|
@ -8,8 +8,6 @@ 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
|
||||
import datetime
|
||||
import time
|
||||
|
||||
class CalendarPlugin(DatabrowsePlugin):
|
||||
def __init__(self, field_names=None):
|
||||
|
|
|
@ -7,8 +7,6 @@ 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 datetime
|
||||
import time
|
||||
import urllib
|
||||
|
||||
class FieldChoicePlugin(DatabrowsePlugin):
|
||||
|
|
|
@ -2,8 +2,6 @@ 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
|
||||
import datetime
|
||||
import time
|
||||
|
||||
###########
|
||||
# CHOICES #
|
||||
|
|
|
@ -3,7 +3,6 @@ Formtools Preview application.
|
|||
"""
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.http import Http404
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template.context import RequestContext
|
||||
|
|
|
@ -3,8 +3,6 @@ from django.contrib.formtools import preview
|
|||
from django import http
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.test.client import Client
|
||||
|
||||
|
||||
success_string = "Done was called!"
|
||||
test_data = {'field1': u'foo',
|
||||
|
@ -88,6 +86,3 @@ class PreviewTests(TestCase):
|
|||
response = self.client.post('/test1/', test_data)
|
||||
self.assertEqual(response.content, success_string)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -2,8 +2,7 @@ from django.utils.translation import ungettext, ugettext as _
|
|||
from django.utils.encoding import force_unicode
|
||||
from django import template
|
||||
from django.template import defaultfilters
|
||||
from django.conf import settings
|
||||
from datetime import date, timedelta
|
||||
from datetime import date
|
||||
import re
|
||||
|
||||
register = template.Library()
|
||||
|
|
|
@ -7,7 +7,6 @@ from django.newforms import ValidationError
|
|||
from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
|
||||
from django.utils.encoding import smart_unicode
|
||||
from django.utils.translation import ugettext
|
||||
import re
|
||||
|
||||
class ARProvinceSelect(Select):
|
||||
"""
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
from django import newforms as forms
|
||||
|
||||
DEFAULT_DATE_INPUT_FORMATS = (
|
||||
'%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'
|
||||
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 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'
|
||||
)
|
||||
|
||||
DEFAULT_DATETIME_INPUT_FORMATS = (
|
||||
'%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', # '2006-10-25'
|
||||
'%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', # '25/10/2006'
|
||||
'%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', # '25/10/06'
|
||||
)
|
||||
|
||||
class DateField(forms.DateField):
|
||||
"""
|
||||
A date input field which uses non-US date input formats by default.
|
||||
"""
|
||||
def __init__(self, input_formats=None, *args, **kwargs):
|
||||
input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
|
||||
super(DateField, self).__init__(input_formats=input_formats, *args, **kwargs)
|
||||
|
||||
class DateTimeField(forms.DateTimeField):
|
||||
"""
|
||||
A date and time input field which uses non-US date and time input formats
|
||||
by default.
|
||||
"""
|
||||
def __init__(self, input_formats=None, *args, **kwargs):
|
||||
input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
|
||||
super(DateTimeField, self).__init__(input_formats=input_formats, *args, **kwargs)
|
||||
from django import newforms as forms
|
||||
|
||||
DEFAULT_DATE_INPUT_FORMATS = (
|
||||
'%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'
|
||||
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 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'
|
||||
)
|
||||
|
||||
DEFAULT_DATETIME_INPUT_FORMATS = (
|
||||
'%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', # '2006-10-25'
|
||||
'%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', # '25/10/2006'
|
||||
'%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', # '25/10/06'
|
||||
)
|
||||
|
||||
class DateField(forms.DateField):
|
||||
"""
|
||||
A date input field which uses non-US date input formats by default.
|
||||
"""
|
||||
def __init__(self, input_formats=None, *args, **kwargs):
|
||||
input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
|
||||
super(DateField, self).__init__(input_formats=input_formats, *args, **kwargs)
|
||||
|
||||
class DateTimeField(forms.DateTimeField):
|
||||
"""
|
||||
A date and time input field which uses non-US date and time input formats
|
||||
by default.
|
||||
"""
|
||||
def __init__(self, input_formats=None, *args, **kwargs):
|
||||
input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
|
||||
super(DateTimeField, self).__init__(input_formats=input_formats, *args, **kwargs)
|
||||
|
|
|
@ -7,8 +7,6 @@ from django.newforms import ValidationError
|
|||
from django.utils.translation import ugettext
|
||||
from django.newforms.fields import RegexField, Select
|
||||
|
||||
import re
|
||||
|
||||
class JPPostalCodeField(RegexField):
|
||||
"""
|
||||
A form field that validates its input is a Japanese postcode.
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
import datetime
|
||||
import base64
|
||||
import md5
|
||||
import random
|
||||
import cPickle as pickle
|
||||
|
||||
from django.db import models
|
||||
|
|
|
@ -14,7 +14,6 @@ u'lorem ipsum dolor'
|
|||
"""
|
||||
|
||||
from django.contrib.webdesign.lorem_ipsum import *
|
||||
import datetime
|
||||
|
||||
if __name__ == '__main__':
|
||||
import doctest
|
||||
|
|
|
@ -4,7 +4,6 @@ Serialize data to/from JSON
|
|||
|
||||
import datetime
|
||||
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 Deserializer as PythonDeserializer
|
||||
try:
|
||||
|
|
|
@ -4,7 +4,6 @@ YAML serializer.
|
|||
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
from django.db import models
|
||||
from django.core.serializers.python import Serializer as PythonSerializer
|
||||
from django.core.serializers.python import Deserializer as PythonDeserializer
|
||||
|
|
|
@ -21,7 +21,6 @@ if (version < (1,2,1) or (version[:3] == (1, 2, 1) and
|
|||
|
||||
from MySQLdb.converters import conversions
|
||||
from MySQLdb.constants import FIELD_TYPE
|
||||
import types
|
||||
import re
|
||||
|
||||
# Raise exceptions for database warnings if DEBUG is on
|
||||
|
|
|
@ -100,7 +100,7 @@ __all__ = [
|
|||
|
||||
import __future__
|
||||
|
||||
import sys, traceback, inspect, linecache, os, re, types
|
||||
import sys, traceback, inspect, linecache, os, re
|
||||
import unittest, difflib, pdb, tempfile
|
||||
import warnings
|
||||
from StringIO import StringIO
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import datetime
|
||||
import sys
|
||||
from cStringIO import StringIO
|
||||
from urlparse import urlparse
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate, login
|
||||
from django.core.handlers.base import BaseHandler
|
||||
|
|
|
@ -146,4 +146,3 @@ def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
|
|||
teardown_test_environment()
|
||||
|
||||
return len(result.failures) + len(result.errors)
|
||||
|
Loading…
Reference in New Issue