Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit f1a24be01cbd7d268d90c3fdf65a08fe1407f440 1 parent 3eec925
@malcolmt malcolmt authored
View
2  django/contrib/admin/views/decorators.py
@@ -5,7 +5,7 @@
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.")
View
2  django/contrib/databrowse/plugins/calendars.py
@@ -8,8 +8,6 @@
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):
View
2  django/contrib/databrowse/plugins/fieldchoices.py
@@ -7,8 +7,6 @@
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):
View
2  django/contrib/databrowse/views.py
@@ -2,8 +2,6 @@
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 #
View
1  django/contrib/formtools/preview.py
@@ -3,7 +3,6 @@
"""
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
View
5 django/contrib/formtools/tests.py
@@ -3,8 +3,6 @@
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 @@ def test_form_submit(self):
response = self.client.post('/test1/', test_data)
self.assertEqual(response.content, success_string)
-
-if __name__ == '__main__':
- unittest.main()
View
3  django/contrib/humanize/templatetags/humanize.py
@@ -2,8 +2,7 @@
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()
View
1  django/contrib/localflavor/ar/forms.py
@@ -7,7 +7,6 @@
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):
"""
View
76 django/contrib/localflavor/generic/forms.py
@@ -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)
View
2  django/contrib/localflavor/jp/forms.py
@@ -7,8 +7,6 @@
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.
View
5 django/contrib/sessions/models.py
@@ -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
View
1  django/contrib/webdesign/tests.py
@@ -14,7 +14,6 @@
"""
from django.contrib.webdesign.lorem_ipsum import *
-import datetime
if __name__ == '__main__':
import doctest
View
1  django/core/serializers/json.py
@@ -4,7 +4,6 @@
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:
View
1  django/core/serializers/pyyaml.py
@@ -4,7 +4,6 @@
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
View
1  django/db/backends/mysql/base.py
@@ -21,7 +21,6 @@
from MySQLdb.converters import conversions
from MySQLdb.constants import FIELD_TYPE
-import types
import re
# Raise exceptions for database warnings if DEBUG is on
View
2  django/test/_doctest.py
@@ -100,7 +100,7 @@ def _test():
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
View
2  django/test/client.py
@@ -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
View
1  django/test/simple.py
@@ -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)
-
Please sign in to comment.
Something went wrong with that request. Please try again.