Ticket #6481: 0006-Fix-import-and-syntax-errors.patch
File 0006-Fix-import-and-syntax-errors.patch, 12.1 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/views/decorators.py
From 1a4b23175f2e44128bcbf96b618b323e365ce867 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam <calvin@debian.org> Date: Fri, 25 Jan 2008 16:00:04 +0100 Subject: Fix import and syntax errors Remove (some) unused imports, add some needed ones. And fix two syntax errors reported: one is trailing whitespace at EOF, the other CRLF endings. The CRLF endings are due to missing svn:eol-style entries in the SVN repo, but in git there is no such setting. All errors were reported by the pyflakes checker. Signed-off-by: Bastian Kleineidam <calvin@debian.org> diff --git a/django/contrib/admin/views/decorators.py b/django/contrib/admin/views/decorators.py index 4f6662c..d16fc9a 100644
a b from django.contrib.auth import authenticate, login 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,md58 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.") -
django/contrib/databrowse/plugins/calendars.py
diff --git a/django/contrib/databrowse/plugins/calendars.py b/django/contrib/databrowse/plugins/calendars.py index 5d5a020..a798868 100644
a b from django.utils.translation import get_date_formats 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 datetime12 import time13 11 14 12 class CalendarPlugin(DatabrowsePlugin): 15 13 def __init__(self, field_names=None): -
django/contrib/databrowse/plugins/fieldchoices.py
diff --git a/django/contrib/databrowse/plugins/fieldchoices.py b/django/contrib/databrowse/plugins/fieldchoices.py index dea6bac..0a58e7a 100644
a b from django.utils.text import capfirst 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 datetime11 import time12 10 import urllib 13 11 14 12 class FieldChoicePlugin(DatabrowsePlugin): -
django/contrib/databrowse/views.py
diff --git a/django/contrib/databrowse/views.py b/django/contrib/databrowse/views.py index d493f9d..c17aad5 100644
a b from django.db.models import FieldDoesNotExist, DateTimeField 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 datetime6 import time7 5 8 6 ########### 9 7 # CHOICES # -
django/contrib/formtools/preview.py
diff --git a/django/contrib/formtools/preview.py b/django/contrib/formtools/preview.py index bd0ce5c..66583dd 100644
a b Formtools Preview application. 3 3 """ 4 4 5 5 from django.conf import settings 6 from django.core.exceptions import ImproperlyConfigured7 6 from django.http import Http404 8 7 from django.shortcuts import render_to_response 9 8 from django.template.context import RequestContext -
django/contrib/formtools/tests.py
diff --git a/django/contrib/formtools/tests.py b/django/contrib/formtools/tests.py index a5a9222..4314f8e 100644
a b from django.contrib.formtools import preview 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 6 import unittest 8 7 9 8 success_string = "Done was called!" 10 9 test_data = {'field1': u'foo', -
django/contrib/humanize/templatetags/humanize.py
diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index 4aa5a32..05d3223 100644
a b from django.utils.translation import ungettext, ugettext as _ 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() -
django/contrib/localflavor/ar/forms.py
diff --git a/django/contrib/localflavor/ar/forms.py b/django/contrib/localflavor/ar/forms.py index 6374a48..1439ea5 100644
a b from django.newforms import ValidationError 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 re11 10 12 11 class ARProvinceSelect(Select): 13 12 """ -
django/contrib/localflavor/generic/forms.py
diff --git a/django/contrib/localflavor/generic/forms.py b/django/contrib/localflavor/generic/forms.py index a6d8137..a5e431e 100644
a b 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) -
django/contrib/localflavor/jp/forms.py
diff --git a/django/contrib/localflavor/jp/forms.py b/django/contrib/localflavor/jp/forms.py index 13083aa..d726f82 100644
a b from django.newforms import ValidationError 7 7 from django.utils.translation import ugettext 8 8 from django.newforms.fields import RegexField, Select 9 9 10 import re11 12 10 class JPPostalCodeField(RegexField): 13 11 """ 14 12 A form field that validates its input is a Japanese postcode. -
django/contrib/sessions/models.py
diff --git a/django/contrib/sessions/models.py b/django/contrib/sessions/models.py index dfa7bed..4769e63 100644
a b 1 import os2 import sys3 import time4 import datetime5 1 import base64 6 2 import md5 7 import random8 3 import cPickle as pickle 9 4 10 5 from django.db import models -
django/contrib/webdesign/tests.py
diff --git a/django/contrib/webdesign/tests.py b/django/contrib/webdesign/tests.py index da9237a..d155620 100644
a b u'lorem ipsum dolor' 14 14 """ 15 15 16 16 from django.contrib.webdesign.lorem_ipsum import * 17 import datetime18 17 19 18 if __name__ == '__main__': 20 19 import doctest -
django/core/serializers/json.py
diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py index e17b821..20797c0 100644
a b Serialize data to/from JSON 4 4 5 5 import datetime 6 6 from django.utils import simplejson 7 from django.utils.simplejson import decoder8 7 from django.core.serializers.python import Serializer as PythonSerializer 9 8 from django.core.serializers.python import Deserializer as PythonDeserializer 10 9 try: -
django/core/serializers/pyyaml.py
diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py index 4c32a96..58cf59b 100644
a b YAML serializer. 4 4 Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__. 5 5 """ 6 6 7 import datetime8 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 -
django/db/backends/mysql/base.py
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index ba3e9ef..697dcd3 100644
a b if (version < (1,2,1) or (version[:3] == (1, 2, 1) and 21 21 22 22 from MySQLdb.converters import conversions 23 23 from MySQLdb.constants import FIELD_TYPE 24 import types25 24 import re 26 25 27 26 # Raise exceptions for database warnings if DEBUG is on -
django/test/_doctest.py
diff --git a/django/test/_doctest.py b/django/test/_doctest.py index d1308b8..a56483c 100644
a b __all__ = [ 100 100 101 101 import __future__ 102 102 103 import sys, traceback, inspect, linecache, os, re , types103 import sys, traceback, inspect, linecache, os, re 104 104 import unittest, difflib, pdb, tempfile 105 105 import warnings 106 106 from StringIO import StringIO -
django/test/client.py
diff --git a/django/test/client.py b/django/test/client.py index 5460527..c7828e3 100644
a b 1 import datetime2 1 import sys 3 2 from cStringIO import StringIO 4 from urlparse import urlparse5 3 from django.conf import settings 6 4 from django.contrib.auth import authenticate, login 7 5 from django.core.handlers.base import BaseHandler -
django/test/simple.py
diff --git a/django/test/simple.py b/django/test/simple.py index 6fa381a..43e1156 100644
a b 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 150 No newline at end of file