Ticket #6481: 0006-Fix-import-and-syntax-errors.patch

File 0006-Fix-import-and-syntax-errors.patch, 12.1 KB (added by Bastian Kleineidam <calvin@…>, 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  
    55from django.shortcuts import render_to_response
    66from django.utils.translation import ugettext_lazy, ugettext as _
    77from django.utils.safestring import mark_safe
    8 import base64, datetime, md5
     8import base64, md5
    99import cPickle as pickle
    1010
    1111ERROR_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  
    88from django.utils.encoding import force_unicode
    99from django.utils.safestring import mark_safe
    1010from django.views.generic import date_based
    11 import datetime
    12 import time
    1311
    1412class CalendarPlugin(DatabrowsePlugin):
    1513    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  
    77from django.utils.encoding import smart_str, force_unicode
    88from django.utils.safestring import mark_safe
    99from django.views.generic import date_based
    10 import datetime
    11 import time
    1210import urllib
    1311
    1412class 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  
    22from django.http import Http404
    33from django.shortcuts import render_to_response
    44from django.contrib.databrowse.datastructures import EasyModel, EasyChoice
    5 import datetime
    6 import time
    75
    86###########
    97# 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.  
    33"""
    44
    55from django.conf import settings
    6 from django.core.exceptions import ImproperlyConfigured
    76from django.http import Http404
    87from django.shortcuts import render_to_response
    98from 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  
    33from django import http
    44from django.conf import settings
    55from django.test import TestCase
    6 from django.test.client import Client
    7 
     6import unittest
    87
    98success_string = "Done was called!"
    109test_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 _  
    22from django.utils.encoding import force_unicode
    33from django import template
    44from django.template import defaultfilters
    5 from django.conf import settings
    6 from datetime import date, timedelta
     5from datetime import date
    76import re
    87
    98register = 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  
    77from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
    88from django.utils.encoding import smart_unicode
    99from django.utils.translation import ugettext
    10 import re
    1110
    1211class ARProvinceSelect(Select):
    1312    """
  • 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)
     1from django import newforms as forms
     2
     3DEFAULT_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
     11DEFAULT_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
     23class 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
     31class 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  
    77from django.utils.translation import ugettext
    88from django.newforms.fields import RegexField, Select
    99
    10 import re
    11 
    1210class JPPostalCodeField(RegexField):
    1311    """
    1412    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 os
    2 import sys
    3 import time
    4 import datetime
    51import base64
    62import md5
    7 import random
    83import cPickle as pickle
    94
    105from 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'  
    1414"""
    1515
    1616from django.contrib.webdesign.lorem_ipsum import *
    17 import datetime
    1817
    1918if __name__ == '__main__':
    2019    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  
    44
    55import datetime
    66from django.utils import simplejson
    7 from django.utils.simplejson import decoder
    87from django.core.serializers.python import Serializer as PythonSerializer
    98from django.core.serializers.python import Deserializer as PythonDeserializer
    109try:
  • 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.  
    44Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
    55"""
    66
    7 import datetime
    87from django.db import models
    98from django.core.serializers.python import Serializer as PythonSerializer
    109from 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  
    2121
    2222from MySQLdb.converters import conversions
    2323from MySQLdb.constants import FIELD_TYPE
    24 import types
    2524import re
    2625
    2726# 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__ = [  
    100100
    101101import __future__
    102102
    103 import sys, traceback, inspect, linecache, os, re, types
     103import sys, traceback, inspect, linecache, os, re
    104104import unittest, difflib, pdb, tempfile
    105105import warnings
    106106from 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 datetime
    21import sys
    32from cStringIO import StringIO
    4 from urlparse import urlparse
    53from django.conf import settings
    64from django.contrib.auth import authenticate, login
    75from 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=[]):  
    146146    teardown_test_environment()
    147147   
    148148    return len(result.failures) + len(result.errors)
    149    
    150  No newline at end of file
Back to Top