Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored February 19, 2008
2  django/contrib/admin/views/decorators.py
@@ -5,7 +5,7 @@
5 5
 from django.shortcuts import render_to_response
6 6
 from django.utils.translation import ugettext_lazy, ugettext as _
7 7
 from django.utils.safestring import mark_safe
8  
-import base64, datetime, md5
  8
+import base64, md5
9 9
 import cPickle as pickle
10 10
 
11 11
 ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")
2  django/contrib/databrowse/plugins/calendars.py
@@ -8,8 +8,6 @@
8 8
 from django.utils.encoding import force_unicode
9 9
 from django.utils.safestring import mark_safe
10 10
 from django.views.generic import date_based
11  
-import datetime
12  
-import time
13 11
 
14 12
 class CalendarPlugin(DatabrowsePlugin):
15 13
     def __init__(self, field_names=None):
2  django/contrib/databrowse/plugins/fieldchoices.py
@@ -7,8 +7,6 @@
7 7
 from django.utils.encoding import smart_str, force_unicode
8 8
 from django.utils.safestring import mark_safe
9 9
 from django.views.generic import date_based
10  
-import datetime
11  
-import time
12 10
 import urllib
13 11
 
14 12
 class FieldChoicePlugin(DatabrowsePlugin):
2  django/contrib/databrowse/views.py
@@ -2,8 +2,6 @@
2 2
 from django.http import Http404
3 3
 from django.shortcuts import render_to_response
4 4
 from django.contrib.databrowse.datastructures import EasyModel, EasyChoice
5  
-import datetime
6  
-import time
7 5
 
8 6
 ###########
9 7
 # CHOICES #
1  django/contrib/formtools/preview.py
@@ -3,7 +3,6 @@
3 3
 """
4 4
 
5 5
 from django.conf import settings
6  
-from django.core.exceptions import ImproperlyConfigured
7 6
 from django.http import Http404
8 7
 from django.shortcuts import render_to_response
9 8
 from django.template.context import RequestContext
5  django/contrib/formtools/tests.py
@@ -3,8 +3,6 @@
3 3
 from django import http
4 4
 from django.conf import settings
5 5
 from django.test import TestCase
6  
-from django.test.client import Client
7  
-
8 6
 
9 7
 success_string = "Done was called!"
10 8
 test_data = {'field1': u'foo',
@@ -88,6 +86,3 @@ def test_form_submit(self):
88 86
         response = self.client.post('/test1/', test_data)
89 87
         self.assertEqual(response.content, success_string)
90 88
 
91  
-
92  
-if __name__ == '__main__':
93  
-    unittest.main()
3  django/contrib/humanize/templatetags/humanize.py
@@ -2,8 +2,7 @@
2 2
 from django.utils.encoding import force_unicode
3 3
 from django import template
4 4
 from django.template import defaultfilters
5  
-from django.conf import settings
6  
-from datetime import date, timedelta
  5
+from datetime import date
7 6
 import re
8 7
 
9 8
 register = template.Library()
1  django/contrib/localflavor/ar/forms.py
@@ -7,7 +7,6 @@
7 7
 from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
8 8
 from django.utils.encoding import smart_unicode
9 9
 from django.utils.translation import ugettext
10  
-import re
11 10
 
12 11
 class ARProvinceSelect(Select):
13 12
     """
76  django/contrib/localflavor/generic/forms.py
... ...
@@ -1,38 +1,38 @@
1  
-from django import newforms as forms
2  
-
3  
-DEFAULT_DATE_INPUT_FORMATS = (
4  
-    '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
5  
-    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
6  
-    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
7  
-    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
8  
-    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
9  
-)
10  
-
11  
-DEFAULT_DATETIME_INPUT_FORMATS = (
12  
-    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
13  
-    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
14  
-    '%Y-%m-%d',              # '2006-10-25'
15  
-    '%d/%m/%Y %H:%M:%S',     # '25/10/2006 14:30:59'
16  
-    '%d/%m/%Y %H:%M',        # '25/10/2006 14:30'
17  
-    '%d/%m/%Y',              # '25/10/2006'
18  
-    '%d/%m/%y %H:%M:%S',     # '25/10/06 14:30:59'
19  
-    '%d/%m/%y %H:%M',        # '25/10/06 14:30'
20  
-    '%d/%m/%y',              # '25/10/06'
21  
-)
22  
-
23  
-class DateField(forms.DateField):
24  
-    """
25  
-    A date input field which uses non-US date input formats by default.
26  
-    """
27  
-    def __init__(self, input_formats=None, *args, **kwargs):
28  
-        input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
29  
-        super(DateField, self).__init__(input_formats=input_formats, *args, **kwargs)
30  
-
31  
-class DateTimeField(forms.DateTimeField):
32  
-    """
33  
-    A date and time input field which uses non-US date and time input formats
34  
-    by default.
35  
-    """
36  
-    def __init__(self, input_formats=None, *args, **kwargs):
37  
-        input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
38  
-        super(DateTimeField, self).__init__(input_formats=input_formats, *args, **kwargs)
  1
+from django import newforms as forms
  2
+
  3
+DEFAULT_DATE_INPUT_FORMATS = (
  4
+    '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
  5
+    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
  6
+    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
  7
+    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
  8
+    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
  9
+)
  10
+
  11
+DEFAULT_DATETIME_INPUT_FORMATS = (
  12
+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
  13
+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
  14
+    '%Y-%m-%d',              # '2006-10-25'
  15
+    '%d/%m/%Y %H:%M:%S',     # '25/10/2006 14:30:59'
  16
+    '%d/%m/%Y %H:%M',        # '25/10/2006 14:30'
  17
+    '%d/%m/%Y',              # '25/10/2006'
  18
+    '%d/%m/%y %H:%M:%S',     # '25/10/06 14:30:59'
  19
+    '%d/%m/%y %H:%M',        # '25/10/06 14:30'
  20
+    '%d/%m/%y',              # '25/10/06'
  21
+)
  22
+
  23
+class DateField(forms.DateField):
  24
+    """
  25
+    A date input field which uses non-US date input formats by default.
  26
+    """
  27
+    def __init__(self, input_formats=None, *args, **kwargs):
  28
+        input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS
  29
+        super(DateField, self).__init__(input_formats=input_formats, *args, **kwargs)
  30
+
  31
+class DateTimeField(forms.DateTimeField):
  32
+    """
  33
+    A date and time input field which uses non-US date and time input formats
  34
+    by default.
  35
+    """
  36
+    def __init__(self, input_formats=None, *args, **kwargs):
  37
+        input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS
  38
+        super(DateTimeField, self).__init__(input_formats=input_formats, *args, **kwargs)
2  django/contrib/localflavor/jp/forms.py
@@ -7,8 +7,6 @@
7 7
 from django.utils.translation import ugettext
8 8
 from django.newforms.fields import RegexField, Select
9 9
 
10  
-import re
11  
-
12 10
 class JPPostalCodeField(RegexField):
13 11
     """
14 12
     A form field that validates its input is a Japanese postcode.
5  django/contrib/sessions/models.py
... ...
@@ -1,10 +1,5 @@
1  
-import os
2  
-import sys
3  
-import time
4  
-import datetime
5 1
 import base64
6 2
 import md5
7  
-import random
8 3
 import cPickle as pickle
9 4
 
10 5
 from django.db import models
1  django/contrib/webdesign/tests.py
@@ -14,7 +14,6 @@
14 14
 """
15 15
 
16 16
 from django.contrib.webdesign.lorem_ipsum import *
17  
-import datetime
18 17
 
19 18
 if __name__ == '__main__':
20 19
     import doctest
1  django/core/serializers/json.py
@@ -4,7 +4,6 @@
4 4
 
5 5
 import datetime
6 6
 from django.utils import simplejson
7  
-from django.utils.simplejson import decoder
8 7
 from django.core.serializers.python import Serializer as PythonSerializer
9 8
 from django.core.serializers.python import Deserializer as PythonDeserializer
10 9
 try:
1  django/core/serializers/pyyaml.py
@@ -4,7 +4,6 @@
4 4
 Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
5 5
 """
6 6
 
7  
-import datetime
8 7
 from django.db import models
9 8
 from django.core.serializers.python import Serializer as PythonSerializer
10 9
 from django.core.serializers.python import Deserializer as PythonDeserializer
1  django/db/backends/mysql/base.py
@@ -21,7 +21,6 @@
21 21
 
22 22
 from MySQLdb.converters import conversions
23 23
 from MySQLdb.constants import FIELD_TYPE
24  
-import types
25 24
 import re
26 25
 
27 26
 # Raise exceptions for database warnings if DEBUG is on
2  django/test/_doctest.py
@@ -100,7 +100,7 @@ def _test():
100 100
 
101 101
 import __future__
102 102
 
103  
-import sys, traceback, inspect, linecache, os, re, types
  103
+import sys, traceback, inspect, linecache, os, re
104 104
 import unittest, difflib, pdb, tempfile
105 105
 import warnings
106 106
 from StringIO import StringIO
2  django/test/client.py
... ...
@@ -1,7 +1,5 @@
1  
-import datetime
2 1
 import sys
3 2
 from cStringIO import StringIO
4  
-from urlparse import urlparse
5 3
 from django.conf import settings
6 4
 from django.contrib.auth import authenticate, login
7 5
 from django.core.handlers.base import BaseHandler
1  django/test/simple.py
@@ -146,4 +146,3 @@ def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
146 146
     teardown_test_environment()
147 147
     
148 148
     return len(result.failures) + len(result.errors)
149  
-    

0 notes on commit f1a24be

Please sign in to comment.
Something went wrong with that request. Please try again.