Ticket #16225: 16225.patch

File 16225.patch, 133.1 KB (added by Aymeric Augustin, 13 years ago)
  • django/test/client.py

     
    55import mimetypes
    66import warnings
    77from copy import copy
    8 from urlparse import urlparse, urlunparse, urlsplit
     8from urlparse import urlparse, urlsplit
    99try:
    1010    from cStringIO import StringIO
    1111except ImportError:
     
    2424from django.utils.http import urlencode
    2525from django.utils.importlib import import_module
    2626from django.utils.itercompat import is_iterable
    27 from django.db import transaction, close_connection
     27from django.db import close_connection
    2828from django.test.utils import ContextList
    2929
    3030__all__ = ('Client', 'RequestFactory', 'encode_file', 'encode_multipart')
  • django/test/testcases.py

     
    66from urlparse import urlsplit, urlunsplit
    77from xml.dom.minidom import parseString, Node
    88
    9 from django.conf import settings, UserSettingsHolder
     9from django.conf import settings
    1010from django.core import mail
    1111from django.core.management import call_command
    1212from django.core.signals import request_started
  • django/test/utils.py

     
    11from __future__ import with_statement
    22
    3 import sys
    4 import time
    5 import os
    63import warnings
    74from django.conf import settings, UserSettingsHolder
    85from django.core import mail
    9 from django.core.mail.backends import locmem
    106from django.test.signals import template_rendered, setting_changed
    117from django.template import Template, loader, TemplateDoesNotExist
    128from django.template.loaders import cached
  • django/db/models/sql/compiler.py

     
    55from django.db.models.sql.constants import *
    66from django.db.models.sql.datastructures import EmptyResultSet
    77from django.db.models.sql.expressions import SQLEvaluator
    8 from django.db.models.sql.query import get_proxied_model, get_order_dir, \
    9      select_related_descend, Query
     8from django.db.models.sql.query import (get_proxied_model, get_order_dir,
     9     select_related_descend, Query)
    1010from django.db.utils import DatabaseError
    1111
    1212class SQLCompiler(object):
  • django/db/models/sql/where.py

     
    66
    77from django.utils import tree
    88from django.db.models.fields import Field
    9 from django.db.models.query_utils import QueryWrapper
    109from datastructures import EmptyResultSet, FullResultSet
    1110
    1211# Connection types
  • django/db/models/sql/subqueries.py

     
    33"""
    44
    55from django.core.exceptions import FieldError
    6 from django.db import connections
    76from django.db.models.fields import DateField, FieldDoesNotExist
    87from django.db.models.sql.constants import *
    98from django.db.models.sql.datastructures import Date
    10 from django.db.models.sql.expressions import SQLEvaluator
    119from django.db.models.sql.query import Query
    1210from django.db.models.sql.where import AND, Constraint
    1311
  • django/db/models/base.py

     
    11import copy
    22import sys
    3 import types
    43from functools import update_wrapper
    54from itertools import izip
    65
     
    87from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS
    98from django.core import validators
    109from django.db.models.fields import AutoField, FieldDoesNotExist
    11 from django.db.models.fields.related import (OneToOneRel, ManyToOneRel,
    12     OneToOneField, add_lazy_relation)
     10from django.db.models.fields.related import ManyToOneRel, OneToOneField, add_lazy_relation
    1311from django.db.models.query import Q
    1412from django.db.models.query_utils import DeferredAttribute
    1513from django.db.models.deletion import Collector
  • django/db/models/manager.py

     
    11import copy
    2 from django.conf import settings
    32from django.db import router
    43from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet
    54from django.db.models import signals
  • django/db/models/loading.py

     
    66from django.utils.importlib import import_module
    77from django.utils.module_loading import module_has_submodule
    88
    9 import imp
    109import sys
    1110import os
    1211import threading
  • django/db/models/fields/related.py

     
    1 from django.conf import settings
    2 from django.db import connection, router, transaction
     1from django.db import connection, router
    32from django.db.backends import util
    43from django.db.models import signals, get_model
    54from django.db.models.fields import (AutoField, Field, IntegerField,
     
    98from django.db.models.query_utils import QueryWrapper
    109from django.db.models.deletion import CASCADE
    1110from django.utils.encoding import smart_unicode
    12 from django.utils.translation import (ugettext_lazy as _, string_concat,
    13     ungettext, ugettext)
     11from django.utils.translation import ugettext_lazy as _, string_concat
    1412from django.utils.functional import curry
    1513from django.core import exceptions
    1614from django import forms
  • django/db/models/fields/files.py

     
    11import datetime
    22import os
    33
    4 from django.conf import settings
    54from django.db.models.fields import Field
    6 from django.core.files.base import File, ContentFile
     5from django.core.files.base import File
    76from django.core.files.storage import default_storage
    8 from django.core.files.images import ImageFile, get_image_dimensions
    9 from django.core.files.uploadedfile import UploadedFile
    10 from django.utils.functional import curry
     7from django.core.files.images import ImageFile
    118from django.db.models import signals
    129from django.utils.encoding import force_unicode, smart_str
    13 from django.utils.translation import ugettext_lazy, ugettext as _
     10from django.utils.translation import ugettext_lazy as _
    1411from django import forms
    15 from django.db.models.loading import cache
    1612
    1713class FieldFile(File):
    1814    def __init__(self, instance, field, name):
     
    215211    # The descriptor to use for accessing the attribute off of the class.
    216212    descriptor_class = FileDescriptor
    217213
    218     description = ugettext_lazy("File path")
     214    description = _("File path")
    219215
    220216    def __init__(self, verbose_name=None, name=None, upload_to='', storage=None, **kwargs):
    221217        for arg in ('primary_key', 'unique'):
     
    321317class ImageField(FileField):
    322318    attr_class = ImageFieldFile
    323319    descriptor_class = ImageFileDescriptor
    324     description = ugettext_lazy("File path")
     320    description = _("File path")
    325321
    326322    def __init__(self, verbose_name=None, name=None, width_field=None, height_field=None, **kwargs):
    327323        self.width_field, self.height_field = width_field, height_field
  • django/db/models/deletion.py

     
    33
    44from django.db import connections, transaction, IntegrityError
    55from django.db.models import signals, sql
    6 from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
    76from django.utils.datastructures import SortedDict
    87
    98
  • django/db/models/query.py

     
    33"""
    44
    55import copy
    6 from itertools import izip
    76
    87from django.db import connections, router, transaction, IntegrityError
    9 from django.db.models.aggregates import Aggregate
    10 from django.db.models.fields import DateField
    118from django.db.models.query_utils import (Q, select_related_descend,
    129    deferred_class_factory, InvalidQuery)
    1310from django.db.models.deletion import Collector
    14 from django.db.models import signals, sql
     11from django.db.models import sql
    1512
    1613# Used to control how many objects are worked with at once in some cases (e.g.
    1714# when deleting objects).
  • django/db/models/query_utils.py

     
    1010
    1111from django.db.backends import util
    1212from django.utils import tree
    13 from django.utils.datastructures import SortedDict
    1413
    1514
    1615class InvalidQuery(Exception):
  • django/db/__init__.py

     
    11from django.conf import settings
    22from django.core import signals
    33from django.core.exceptions import ImproperlyConfigured
    4 from django.db.utils import ConnectionHandler, ConnectionRouter, load_backend, DEFAULT_DB_ALIAS, \
    5                             DatabaseError, IntegrityError
     4from django.db.utils import (ConnectionHandler, ConnectionRouter,
     5    load_backend, DEFAULT_DB_ALIAS, DatabaseError, IntegrityError)
    66
    77__all__ = ('backend', 'connection', 'connections', 'router', 'DatabaseError',
    88    'IntegrityError', 'DEFAULT_DB_ALIAS')
  • django/db/backends/sqlite3/base.py

     
    55standard library.
    66"""
    77
     8import datetime
     9import decimal
    810import re
    911import sys
    10 import datetime
    1112
    1213from django.db import utils
    1314from django.db.backends import *
  • django/db/backends/mysql/base.py

     
    44Requires MySQLdb: http://sourceforge.net/projects/mysql-python
    55"""
    66
     7import decimal
    78import re
    89import sys
    910
  • django/db/backends/oracle/base.py

     
    66
    77
    88import datetime
    9 from decimal import Decimal
     9import decimal
    1010import sys
    1111
    1212
     
    730730                    # This will normally be an integer from a sequence,
    731731                    # but it could be a decimal value.
    732732                    if '.' in value:
    733                         value = Decimal(value)
     733                        value = decimal.Decimal(value)
    734734                    else:
    735735                        value = int(value)
    736736                else:
     
    743743                if scale == 0:
    744744                    value = int(value)
    745745                else:
    746                     value = Decimal(value)
     746                    value = decimal.Decimal(value)
    747747            elif '.' in value:
    748748                # No type information. This normally comes from a
    749749                # mathematical expression in the SELECT list. Guess int
    750750                # or Decimal based on whether it has a decimal point.
    751                 value = Decimal(value)
     751                value = decimal.Decimal(value)
    752752            else:
    753753                value = int(value)
    754754        elif desc[1] in (Database.STRING, Database.FIXED_CHAR,
  • django/db/backends/oracle/creation.py

     
    1 import sys, time
     1import sys
     2import time
    23from django.db.backends.creation import BaseDatabaseCreation
    34
    45TEST_DATABASE_PREFIX = 'test_'
  • django/db/backends/__init__.py

     
    1 import decimal
    21try:
    32    import thread
    43except ImportError:
  • django/db/backends/postgresql_psycopg2/base.py

     
    44Requires psycopg 2: http://initd.org/projects/psycopg2
    55"""
    66
     7import decimal
    78import sys
    89
    910from django.db import utils
  • django/db/backends/postgresql_psycopg2/operations.py

     
    1 import re
    2 
    31from django.db.backends import BaseDatabaseOperations
    42
    53
  • django/db/backends/dummy/base.py

     
    77ImproperlyConfigured.
    88"""
    99
     10import decimal
     11
    1012from django.core.exceptions import ImproperlyConfigured
    1113from django.db.backends import *
    1214from django.db.backends.creation import BaseDatabaseCreation
  • django/db/transaction.py

     
    1313"""
    1414from __future__ import with_statement
    1515
    16 import sys
    1716from functools import wraps
    1817
    19 from django.conf import settings
    2018from django.db import connections, DEFAULT_DB_ALIAS
    2119
    2220
  • django/forms/extras/widgets.py

     
    22Extra HTML Widget classes
    33"""
    44
    5 import time
    65import datetime
    76import re
    87
  • django/forms/models.py

     
    88from django.utils.text import get_text_list, capfirst
    99from django.utils.translation import ugettext_lazy as _, ugettext
    1010
    11 from django.core.exceptions import ValidationError, NON_FIELD_ERRORS, \
    12                                    FieldError
     11from django.core.exceptions import ValidationError, NON_FIELD_ERRORS, FieldError
    1312from django.core.validators import EMPTY_VALUES
    1413from util import ErrorList
    1514from forms import BaseForm, get_declared_fields
  • django/core/mail/__init__.py

     
    1111# django/core/mail.py before the introduction of email
    1212# backends and the subsequent reorganization (See #10355)
    1313from django.core.mail.utils import CachedDnsName, DNS_NAME
    14 from django.core.mail.message import \
    15     EmailMessage, EmailMultiAlternatives, \
    16     SafeMIMEText, SafeMIMEMultipart, \
    17     DEFAULT_ATTACHMENT_MIME_TYPE, make_msgid, \
    18     BadHeaderError, forbid_multi_line_headers
     14from django.core.mail.message import (
     15    EmailMessage, EmailMultiAlternatives,
     16    SafeMIMEText, SafeMIMEMultipart,
     17    DEFAULT_ATTACHMENT_MIME_TYPE, make_msgid,
     18    BadHeaderError, forbid_multi_line_headers)
    1919from django.core.mail.backends.smtp import EmailBackend as _SMTPConnection
    2020
    2121def get_connection(backend=None, fail_silently=False, **kwds):
  • django/core/servers/fastcgi.py

     
    1212pass to this server.
    1313"""
    1414
     15import os
     16import sys
    1517from django.utils import importlib
    16 import sys, os
    1718
    1819__version__ = "0.1"
    1920__all__ = ["runfastcgi"]
  • django/core/serializers/base.py

     
    55from StringIO import StringIO
    66
    77from django.db import models
    8 from django.utils.encoding import smart_str, smart_unicode
    9 from django.utils import datetime_safe
     8from django.utils.encoding import smart_unicode
    109
    1110class SerializerDoesNotExist(KeyError):
    1211    """The requested serializer was not found."""
  • django/core/handlers/profiler-hotshot.py

     
    1 import hotshot, time, os
     1import hotshot
     2import os
     3import time
     4
    25from django.core.handlers.modpython import ModPythonHandler
    36
    47PROFILE_DATA_DIR = "/var/log/cmsprofile"
  • django/core/handlers/wsgi.py

     
    1 from pprint import pformat
    21import sys
    32from threading import Lock
    43try:
  • django/core/handlers/modpython.py

     
    11import os
    2 from pprint import pformat
    32import sys
    43from warnings import warn
    54
     
    87from django.core.handlers.base import BaseHandler
    98from django.core.urlresolvers import set_script_prefix
    109from django.utils import datastructures
    11 from django.utils.encoding import force_unicode, smart_str, iri_to_uri
     10from django.utils.encoding import force_unicode, iri_to_uri
    1211from django.utils.log import getLogger
    1312
    1413logger = getLogger('django.request')
  • django/core/cache/backends/base.py

     
    22
    33import warnings
    44
    5 from django.conf import settings
    65from django.core.exceptions import ImproperlyConfigured, DjangoRuntimeWarning
    76from django.utils.encoding import smart_str
    87from django.utils.importlib import import_module
  • django/core/cache/backends/db.py

     
    22
    33from django.core.cache.backends.base import BaseCache
    44from django.db import connections, router, transaction, DatabaseError
    5 import base64, time
     5import base64
    66from datetime import datetime
    77try:
    88    import cPickle as pickle
    99except ImportError:
    1010    import pickle
     11import time
    1112
    1213class Options(object):
    1314    """A class that will quack like a Django model _meta class.
  • django/core/cache/backends/memcached.py

     
    44from threading import local
    55
    66from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
    7 from django.utils import importlib
    87
    98class BaseMemcachedCache(BaseCache):
    109    def __init__(self, server, params, library, value_not_found_exception):
  • django/core/management/commands/reset.py

     
    11from optparse import make_option
    22
    3 from django.conf import settings
    43from django.core.management.base import AppCommand, CommandError
    54from django.core.management.color import no_style
    65from django.core.management.sql import sql_reset
  • django/templatetags/future.py

     
    1 from django.conf import settings
    2 from django.template import Library, Node, Template, TemplateSyntaxError
    3 from django.template.defaulttags import kwarg_re, include_is_allowed, SsiNode, URLNode
    4 from django.utils.encoding import smart_str
     1from django.template import Library, TemplateSyntaxError
     2from django.template.defaulttags import kwarg_re, SsiNode, URLNode
    53
    64
    75register = Library()
  • django/templatetags/l10n.py

     
    1 from django.conf import settings
    21from django.template import Node
    32from django.template import TemplateSyntaxError, Library
    43from django.utils import formats
  • django/templatetags/i18n.py

     
    11import re
    22
    3 from django.template import Node, Variable, VariableNode
     3from django.template import Node, Variable
    44from django.template import TemplateSyntaxError, TokenParser, Library
    55from django.template import TOKEN_TEXT, TOKEN_VAR
    66from django.template.base import _render_value_in_context
    77from django.utils import translation
    8 from django.utils.encoding import force_unicode
    98from django.template.defaulttags import token_kwargs
    109
    1110register = Library()
  • django/templatetags/cache.py

     
    22from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
    33from django.template import resolve_variable
    44from django.core.cache import cache
    5 from django.utils.encoding import force_unicode
    65from django.utils.http import urlquote
    76
    87register = Library()
  • django/views/decorators/http.py

     
    33"""
    44
    55from calendar import timegm
    6 from datetime import timedelta
    76from functools import wraps
    87
    98from django.utils.decorators import decorator_from_middleware, available_attrs
  • django/views/generic/base.py

     
    11from functools import update_wrapper
    22from django import http
    33from django.core.exceptions import ImproperlyConfigured
    4 from django.template import RequestContext, loader
    54from django.template.response import TemplateResponse
    65from django.utils.log import getLogger
    76from django.utils.decorators import classonlymethod
  • django/views/generic/list.py

     
    1 import re
    2 
    31from django.core.paginator import Paginator, InvalidPage
    42from django.core.exceptions import ImproperlyConfigured
    53from django.http import Http404
  • django/views/generic/detail.py

     
    1 import re
    2 
    31from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
    42from django.http import Http404
    53from django.utils.encoding import smart_str
  • django/views/debug.py

     
    33import re
    44import sys
    55import types
    6 from pprint import pformat
    76
    87from django.conf import settings
    98from django.http import (HttpResponse, HttpResponseServerError,
  • django/dispatch/saferef.py

     
    55aren't handled by the core weakref module).
    66"""
    77
    8 import weakref, traceback
     8import traceback
     9import weakref
    910
    1011def safeRef(target, onDelete = None):
    1112    """Return a *safe* weak reference to a callable target
  • django/contrib/gis/shortcuts.py

     
    1 import cStringIO, zipfile
     1try:
     2    from cStringIO import StringIO
     3except ImportError:
     4    from StringIO import StringIO
     5import zipfile
    26from django.conf import settings
    37from django.http import HttpResponse
    48from django.template import loader
    59
    610def compress_kml(kml):
    711    "Returns compressed KMZ from the given KML string."
    8     kmz = cStringIO.StringIO()
     12    kmz = StringIO()
    913    zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
    1014    zf.writestr('doc.kml', kml.encode(settings.DEFAULT_CHARSET))
    1115    zf.close()
  • django/contrib/gis/db/models/sql/aggregates.py

     
    11from django.db.models.sql.aggregates import *
    22from django.contrib.gis.db.models.fields import GeometryField
    3 from django.contrib.gis.db.models.sql.conversion import GeomField
    43
    54class GeoAggregate(Aggregate):
    65    # Default SQL template for spatial aggregates.
  • django/contrib/gis/db/models/sql/where.py

     
    1 from django.db.models.fields import Field, FieldDoesNotExist
     1from django.db.models.fields import FieldDoesNotExist
    22from django.db.models.sql.constants import LOOKUP_SEP
    33from django.db.models.sql.expressions import SQLEvaluator
    44from django.db.models.sql.where import Constraint, WhereNode
  • django/contrib/gis/db/models/__init__.py

     
    88from django.contrib.gis.db.models.manager import GeoManager
    99
    1010# The geographic-enabled fields.
    11 from django.contrib.gis.db.models.fields import \
    12      GeometryField, PointField, LineStringField, PolygonField, \
    13      MultiPointField, MultiLineStringField, MultiPolygonField, \
    14      GeometryCollectionField
     11from django.contrib.gis.db.models.fields import (
     12     GeometryField, PointField, LineStringField, PolygonField,
     13     MultiPointField, MultiLineStringField, MultiPolygonField,
     14     GeometryCollectionField)
  • django/contrib/gis/db/models/query.py

     
    11from django.db import connections
    2 from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
     2from django.db.models.query import QuerySet, ValuesQuerySet, ValuesListQuerySet
    33
    44from django.contrib.gis.db.models import aggregates
    5 from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
    6 from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery, GeoWhereNode
     5from django.contrib.gis.db.models.fields import get_srid_info, PointField, LineStringField
     6from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery
    77from django.contrib.gis.geometry.backend import Geometry
    88from django.contrib.gis.measure import Area, Distance
    99
  • django/contrib/gis/db/backends/spatialite/base.py

     
    33
    44from django.core.exceptions import ImproperlyConfigured
    55from django.db.backends.sqlite3.base import *
    6 from django.db.backends.sqlite3.base import DatabaseWrapper as SqliteDatabaseWrapper, \
    7     _sqlite_extract, _sqlite_date_trunc, _sqlite_regexp
     6from django.db.backends.sqlite3.base import DatabaseWrapper as SqliteDatabaseWrapper
     7from django.db.backends.sqlite3.base import _sqlite_extract, _sqlite_date_trunc, _sqlite_regexp
    88from django.contrib.gis.db.backends.spatialite.client import SpatiaLiteClient
    99from django.contrib.gis.db.backends.spatialite.creation import SpatiaLiteCreation
    1010from django.contrib.gis.db.backends.spatialite.introspection import SpatiaLiteIntrospection
  • django/contrib/gis/db/backends/base.py

     
    33`SpatialRefSys` model the backend.
    44"""
    55import re
    6 from django.conf import settings
    76from django.contrib.gis import gdal
    87
    98class BaseSpatialOperations(object):
  • django/contrib/gis/db/backends/oracle/models.py

     
    88 model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model.
    99"""
    1010from django.contrib.gis.db import models
    11 from django.contrib.gis.db.models.fields import GeometryField
    1211from django.contrib.gis.db.backends.base import SpatialRefSysMixin
    1312
    1413class GeometryColumns(models.Model):
  • django/contrib/gis/admin/options.py

     
    1 from django.conf import settings
    21from django.contrib.admin import ModelAdmin
    32from django.contrib.gis.admin.widgets import OpenLayersWidget
    43from django.contrib.gis.gdal import OGRGeomType
  • django/contrib/gis/geometry/backend/geos.py

     
    1 from django.contrib.gis.geos import \
    2     GEOSGeometry as Geometry, \
    3     GEOSException as GeometryException
     1from django.contrib.gis.geos import (
     2    GEOSGeometry as Geometry, GEOSException as GeometryException)
  • django/contrib/gis/geos/geometry.py

     
    33 inherit from this object.
    44"""
    55# Python, ctypes and types dependencies.
    6 import re
    76import warnings
    8 from ctypes import addressof, byref, c_double, c_size_t
     7from ctypes import addressof, byref, c_double
    98
    109# super-class for mutable list behavior
    1110from django.contrib.gis.geos.mutable_list import ListMixin
  • django/contrib/gis/geos/prototypes/topology.py

     
    77           'geos_linemerge', 'geos_pointonsurface', 'geos_preservesimplify',
    88           'geos_simplify', 'geos_symdifference', 'geos_union', 'geos_relate']
    99
    10 from ctypes import c_char_p, c_double, c_int
     10from ctypes import c_double, c_int
    1111from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE
    1212from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string
    1313from django.contrib.gis.geos.prototypes.geom import geos_char_p
  • django/contrib/gis/geos/prototypes/__init__.py

     
    55"""
    66
    77# Coordinate sequence routines.
    8 from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, \
    9     cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz, \
    10     cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims
     8from django.contrib.gis.geos.prototypes.coordseq import (create_cs, get_cs,
     9    cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz,
     10    cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims)
    1111
    1212# Geometry routines.
    13 from django.contrib.gis.geos.prototypes.geom import from_hex, from_wkb, from_wkt, \
    14     create_point, create_linestring, create_linearring, create_polygon, create_collection, \
    15     destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone, \
    16     geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid, \
    17     get_dims, get_num_coords, get_num_geoms, \
    18     to_hex, to_wkb, to_wkt
     13from django.contrib.gis.geos.prototypes.geom import (from_hex, from_wkb, from_wkt,
     14    create_point, create_linestring, create_linearring, create_polygon, create_collection,
     15    destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone,
     16    geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid,
     17    get_dims, get_num_coords, get_num_geoms,
     18    to_hex, to_wkb, to_wkt)
    1919
    2020# Miscellaneous routines.
    2121from django.contrib.gis.geos.prototypes.misc import *
    2222
    2323# Predicates
    24 from django.contrib.gis.geos.prototypes.predicates import geos_hasz, geos_isempty, \
    25     geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses, \
    26     geos_disjoint, geos_equals, geos_equalsexact, geos_intersects, \
    27     geos_intersects, geos_overlaps, geos_relatepattern, geos_touches, geos_within
     24from django.contrib.gis.geos.prototypes.predicates import (geos_hasz, geos_isempty,
     25    geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses,
     26    geos_disjoint, geos_equals, geos_equalsexact, geos_intersects,
     27    geos_intersects, geos_overlaps, geos_relatepattern, geos_touches, geos_within)
    2828
    2929# Topology routines
    3030from django.contrib.gis.geos.prototypes.topology import *
  • django/contrib/gis/geos/prototypes/geom.py

     
    1 from ctypes import c_char_p, c_int, c_size_t, c_ubyte, c_uint, POINTER
    2 from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, PREPGEOM_PTR, GEOS_PREPARE
    3 from django.contrib.gis.geos.prototypes.errcheck import \
    4     check_geom, check_minus_one, check_sized_string, check_string, check_zero
     1from ctypes import c_char_p, c_int, c_size_t, c_ubyte, POINTER
     2from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR
     3from django.contrib.gis.geos.prototypes.errcheck import (
     4    check_geom, check_minus_one, check_sized_string, check_string, check_zero)
    55from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
    66
    77# This is the return type used by binary output (WKB, HEX) routines.
  • django/contrib/gis/geos/base.py

     
    11from ctypes import c_void_p
    22from types import NoneType
    3 from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
     3from django.contrib.gis.geos.error import GEOSException
    44
    55# Trying to import GDAL libraries, if available.  Have to place in
    66# try/except since this package may be used outside GeoDjango.
  • django/contrib/gis/geos/tests/test_geos.py

     
    1 import ctypes, random, unittest, sys
     1import ctypes
     2import random
     3import unittest
    24from django.contrib.gis.geos import *
    35from django.contrib.gis.geos.base import gdal, numpy, GEOSBase
    46from django.contrib.gis.geos.libgeos import GEOS_PREPARE
  • django/contrib/gis/geos/tests/test_geos_mutation.py

     
    22# Modified from original contribution by Aryeh Leib Taurog, which was
    33# released under the New BSD license.
    44
    5 import copy
    65from django.contrib.gis.geos import *
    76from django.contrib.gis.geos.error import GEOSIndexError
    87from django.utils import unittest
  • django/contrib/gis/geos/tests/test_io.py

     
    1 import binascii, ctypes, unittest
     1import binascii
     2import unittest
    23from django.contrib.gis.geos import GEOSGeometry, WKTReader, WKTWriter, WKBReader, WKBWriter, geos_version_info
    34
    45class GEOSIOTest(unittest.TestCase):
  • django/contrib/gis/geos/collections.py

     
    33 GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
    44"""
    55from ctypes import c_int, c_uint, byref
    6 from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
     6from django.contrib.gis.geos.error import GEOSException
    77from django.contrib.gis.geos.geometry import GEOSGeometry
    8 from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR, GEOS_PREPARE
     8from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOS_PREPARE
    99from django.contrib.gis.geos.linestring import LineString, LinearRing
    1010from django.contrib.gis.geos.point import Point
    1111from django.contrib.gis.geos.polygon import Polygon
  • django/contrib/gis/geos/libgeos.py

     
    66 This module also houses GEOS Pointer utilities, including
    77 get_pointer_arr(), and GEOM_PTR.
    88"""
    9 import os, re, sys
     9import os
     10import re
     11import sys
    1012from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER
    1113from ctypes.util import find_library
    1214from django.contrib.gis.geos.error import GEOSException
  • django/contrib/gis/geos/polygon.py

     
    11from ctypes import c_uint, byref
    2 from django.contrib.gis.geos.error import GEOSIndexError
    32from django.contrib.gis.geos.geometry import GEOSGeometry
    43from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR
    54from django.contrib.gis.geos.linestring import LinearRing
  • django/contrib/gis/utils/layermapping.py

     
    77   http://geodjango.org/docs/layermapping.html
    88"""
    99import sys
    10 from datetime import date, datetime
    1110from decimal import Decimal
    1211from django.core.exceptions import ObjectDoesNotExist
    1312from django.db import connections, DEFAULT_DB_ALIAS
    1413from django.contrib.gis.db.models import GeometryField
    15 from django.contrib.gis.gdal import CoordTransform, DataSource, \
    16     OGRException, OGRGeometry, OGRGeomType, SpatialReference
    17 from django.contrib.gis.gdal.field import \
    18     OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime
     14from django.contrib.gis.gdal import (CoordTransform, DataSource,
     15    OGRException, OGRGeometry, OGRGeomType, SpatialReference)
     16from django.contrib.gis.gdal.field import (
     17    OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime)
    1918from django.db import models, transaction
    2019from django.contrib.localflavor.us.models import USStateField
    2120
  • django/contrib/gis/utils/ogrinspect.py

     
    88from itertools import izip
    99# Requires GDAL to use.
    1010from django.contrib.gis.gdal import DataSource
    11 from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime
     11from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString
    1212
    1313def mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False):
    1414    """
  • django/contrib/gis/utils/geoip.py

     
    3838 >>> g.geos('24.124.1.80').wkt
    3939 'POINT (-95.2087020874023438 39.0392990112304688)'
    4040"""
    41 import os, re
     41import os
     42import re
    4243from ctypes import c_char_p, c_float, c_int, Structure, CDLL, POINTER
    4344from ctypes.util import find_library
    4445from django.conf import settings
  • django/contrib/gis/maps/google/gmap.py

     
    11from django.conf import settings
    2 from django.contrib.gis import geos
    32from django.template.loader import render_to_string
    43from django.utils.safestring import mark_safe
    54
    6 class GoogleMapException(Exception): pass
    7 from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker, GIcon
     5class GoogleMapException(Exception):
     6    pass
    87
     8from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker
     9
    910# The default Google Maps URL (for the API javascript)
    1011# TODO: Internationalize for Japan, UK, etc.
    1112GOOGLE_MAPS_URL='http://maps.google.com/maps?file=api&v=%s&key='
  • django/contrib/gis/maps/google/zoom.py

     
    11from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point
    22from django.contrib.gis.maps.google.gmap import GoogleMapException
    3 from math import pi, sin, cos, log, exp, atan
     3from math import pi, sin, log, exp, atan
    44
    55# Constants used for degree to radian conversion, and vice-versa.
    66DTOR = pi / 180.
  • django/contrib/gis/tests/test_spatialrefsys.py

     
    11from django.db import connection
    22from django.contrib.gis.gdal import GDAL_VERSION
    3 from django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis, spatialite
     3from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite
    44from django.utils import unittest
    55
    66
  • django/contrib/gis/tests/geo3d/tests.py

     
    55from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
    66from django.contrib.gis.utils import LayerMapping, LayerMapError
    77
    8 from models import City3D, Interstate2D, Interstate3D, \
    9     InterstateProj2D, InterstateProj3D, \
    10     Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D
     8from models import (City3D, Interstate2D, Interstate3D,
     9    InterstateProj2D, InterstateProj3D,
     10    Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D)
    1111
    1212data_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'data'))
    1313city_file = os.path.join(data_path, 'cities', 'cities.shp')
  • django/contrib/gis/tests/geogapp/tests.py

     
    7979
    8080    def test06_geography_area(self):
    8181        "Testing that Area calculations work on geography columns."
    82         from django.contrib.gis.measure import A
    8382        # SELECT ST_Area(poly) FROM geogapp_zipcode WHERE code='77002';
    8483        ref_area = 5439084.70637573
    8584        tol = 5
  • django/contrib/gis/tests/distapp/tests.py

     
    1 import os
    2 from decimal import Decimal
    3 
    41from django.db import connection
    52from django.db.models import Q
    6 from django.contrib.gis.geos import GEOSGeometry, Point, LineString
     3from django.contrib.gis.geos import GEOSGeometry, LineString
    74from django.contrib.gis.measure import D # alias for Distance
    85from django.contrib.gis.tests.utils import oracle, postgis, spatialite, no_oracle, no_spatialite
    96from django.test import TestCase
    107
    11 from models import AustraliaCity, Interstate, SouthTexasInterstate, \
    12     SouthTexasCity, SouthTexasCityFt, CensusZipcode, SouthTexasZipcode
     8from models import (AustraliaCity, Interstate, SouthTexasInterstate,
     9    SouthTexasCity, SouthTexasCityFt, CensusZipcode, SouthTexasZipcode)
    1310
    1411class DistanceTest(TestCase):
    1512
  • django/contrib/gis/tests/test_geoip.py

     
    1 import os, unittest
     1import os
     2import unittest
    23from django.db import settings
    34from django.contrib.gis.geos import GEOSGeometry
    45from django.contrib.gis.utils import GeoIP, GeoIPException
  • django/contrib/gis/tests/layermap/tests.py

     
    44
    55from django.utils.unittest import TestCase
    66
    7 from django.contrib.gis.gdal import DataSource, OGRException
     7from django.contrib.gis.gdal import DataSource
    88from django.contrib.gis.tests.utils import mysql
    99from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, MissingForeignKey
    1010
    11 from models import \
    12     City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State, \
    13     city_mapping, co_mapping, cofeat_mapping, inter_mapping
     11from models import (
     12    City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State,
     13    city_mapping, co_mapping, cofeat_mapping, inter_mapping)
    1414
    1515shp_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, 'data'))
    1616city_shp = os.path.join(shp_path, 'cities', 'cities.shp')
  • django/contrib/gis/tests/geoapp/test_regress.py

     
    1 import os, unittest
    2 from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_postgis, no_spatialite
     1import os
     2import unittest
     3from django.contrib.gis.tests.utils import no_mysql, no_spatialite
    34from django.contrib.gis.shortcuts import render_to_kmz
    45from models import City
    56
  • django/contrib/gis/tests/geoapp/tests.py

     
    11import re
    22from django.db import connection
    33from django.contrib.gis import gdal
    4 from django.contrib.gis.geos import fromstr, GEOSGeometry, \
    5     Point, LineString, LinearRing, Polygon, GeometryCollection
    6 from django.contrib.gis.measure import Distance
    7 from django.contrib.gis.tests.utils import \
    8     no_mysql, no_oracle, no_spatialite, \
    9     mysql, oracle, postgis, spatialite
     4from django.contrib.gis.geos import (fromstr, GEOSGeometry,
     5    Point, LineString, LinearRing, Polygon, GeometryCollection)
     6from django.contrib.gis.tests.utils import (
     7    no_mysql, no_oracle, no_spatialite,
     8    mysql, oracle, postgis, spatialite)
    109from django.test import TestCase
    1110
    1211from models import Country, City, PennsylvaniaCity, State, Track
  • django/contrib/gis/tests/geoapp/test_sitemaps.py

     
    1 import cStringIO
     1try:
     2    from cStringIO import StringIO
     3except ImportError:
     4    from StringIO import StringIO
    25from xml.dom import minidom
    36import zipfile
    47from django.conf import settings
     
    6063                    kml_doc = minidom.parseString(self.client.get(kml_url).content)
    6164                elif kml_type == 'kmz':
    6265                    # Have to decompress KMZ before parsing.
    63                     buf = cStringIO.StringIO(self.client.get(kml_url).content)
     66                    buf = StringIO(self.client.get(kml_url).content)
    6467                    zf = zipfile.ZipFile(buf)
    6568                    self.assertEqual(1, len(zf.filelist))
    6669                    self.assertEqual('doc.kml', zf.filelist[0].filename)
  • django/contrib/gis/tests/geoapp/feeds.py

     
    11from django.contrib.gis import feeds
    2 from django.contrib.gis.tests.utils import mysql
    3 from models import City, Country
     2from models import City
    43
    54class TestGeoRSS1(feeds.Feed):
    65    link = '/city/'
  • django/contrib/gis/gdal/datasource.py

     
    3434              val = field.value
    3535"""
    3636# ctypes prerequisites.
    37 from ctypes import byref, c_void_p
     37from ctypes import byref
    3838
    3939# The GDAL C library, OGR exceptions, and the Layer object.
    4040from django.contrib.gis.gdal.base import GDALBase
  • django/contrib/gis/gdal/feature.py

     
    33from django.contrib.gis.gdal.error import OGRException, OGRIndexError
    44from django.contrib.gis.gdal.field import Field
    55from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
    6 from django.contrib.gis.gdal.srs import SpatialReference
    76
    87# ctypes function prototypes
    98from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api
  • django/contrib/gis/gdal/libgdal.py

     
    1 import os, re, sys
     1import os
     2import re
    23from ctypes import c_char_p, CDLL
    34from ctypes.util import find_library
    45from django.contrib.gis.gdal.error import OGRException
  • django/contrib/gis/gdal/prototypes/generation.py

     
    44"""
    55
    66from ctypes import c_char_p, c_double, c_int, c_void_p
    7 from django.contrib.gis.gdal.prototypes.errcheck import \
    8     check_arg_errcode, check_errcode, check_geom, check_geom_offset, \
    9     check_pointer, check_srs, check_str_arg, check_string, check_const_string
     7from django.contrib.gis.gdal.prototypes.errcheck import (
     8    check_arg_errcode, check_errcode, check_geom, check_geom_offset,
     9    check_pointer, check_srs, check_str_arg, check_string, check_const_string)
    1010
    1111class gdal_char_p(c_char_p):
    1212    pass
  • django/contrib/gis/gdal/prototypes/ds.py

     
    66from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER
    77from django.contrib.gis.gdal.envelope import OGREnvelope
    88from django.contrib.gis.gdal.libgdal import lgdal
    9 from django.contrib.gis.gdal.prototypes.generation import \
    10     const_string_output, double_output, geom_output, int_output, \
    11     srs_output, void_output, voidptr_output
     9from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
     10    double_output, geom_output, int_output, srs_output, void_output, voidptr_output)
    1211
    1312c_int_p = POINTER(c_int) # shortcut type
    1413
  • django/contrib/gis/gdal/prototypes/geom.py

     
    1 import re
    2 from datetime import date
    3 from ctypes import c_char, c_char_p, c_double, c_int, c_ubyte, c_void_p, POINTER
     1from ctypes import c_char_p, c_double, c_int, c_void_p, POINTER
    42from django.contrib.gis.gdal.envelope import OGREnvelope
    53from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON
    64from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope
    7 from django.contrib.gis.gdal.prototypes.generation import \
    8     const_string_output, double_output, geom_output, int_output, \
    9     srs_output, string_output, void_output
     5from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
     6    double_output, geom_output, int_output, srs_output, string_output, void_output)
    107
    118### Generation routines specific to this module ###
    129def env_func(f, argtypes):
  • django/contrib/gis/gdal/prototypes/srs.py

     
    11from ctypes import c_char_p, c_int, c_void_p, POINTER
    22from django.contrib.gis.gdal.libgdal import lgdal, std_call
    3 from django.contrib.gis.gdal.prototypes.generation import \
    4     const_string_output, double_output, int_output, \
    5     srs_output, string_output, void_output
     3from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
     4    double_output, int_output, srs_output, string_output, void_output)
    65
    76## Shortcut generation for routines with known parameters.
    87def srs_double(f):
  • django/contrib/gis/gdal/srs.py

     
    2626  >>> print srs.name
    2727  NAD83 / Texas South Central
    2828"""
    29 import re
    30 from ctypes import byref, c_char_p, c_int, c_void_p
     29from ctypes import byref, c_char_p, c_int
    3130
    3231# Getting the error checking routine and exceptions
    3332from django.contrib.gis.gdal.base import GDALBase
    34 from django.contrib.gis.gdal.error import OGRException, SRSException
     33from django.contrib.gis.gdal.error import SRSException
    3534from django.contrib.gis.gdal.prototypes import srs as capi
    3635
    3736#### Spatial Reference class. ####
  • django/contrib/gis/gdal/tests/test_driver.py

     
    1 import os, os.path, unittest
     1import unittest
    22from django.contrib.gis.gdal import Driver, OGRException
    33
    44valid_drivers = ('ESRI Shapefile', 'MapInfo File', 'TIGER', 'S57', 'DGN',
  • django/contrib/gis/gdal/tests/test_geom.py

     
    1 from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, \
    2     OGRException, OGRIndexError, SpatialReference, CoordTransform, \
    3     GDAL_VERSION
     1from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType, OGRException,
     2    OGRIndexError, SpatialReference, CoordTransform, GDAL_VERSION)
    43from django.utils import unittest
    54from django.contrib.gis.geometry.test_data import TestDataMixin
    65
     
    446445
    447446    def test17_pickle(self):
    448447        "Testing pickle support."
    449         import cPickle
     448        try:
     449            import cPickle as pickle
     450        except ImportError:
     451            import pickle
    450452        g1 = OGRGeometry('LINESTRING(1 1 1,2 2 2,3 3 3)', 'WGS84')
    451         g2 = cPickle.loads(cPickle.dumps(g1))
     453        g2 = pickle.loads(pickle.dumps(g1))
    452454        self.assertEqual(g1, g2)
    453455        self.assertEqual(4326, g2.srs.srid)
    454456        self.assertEqual(g1.srs.wkt, g2.srs.wkt)
  • django/contrib/gis/management/commands/inspectdb.py

     
    1 from optparse import make_option
    2 
    3 from django.core.management.base import CommandError
    41from django.core.management.commands.inspectdb import Command as InspectDBCommand
    52
    63class Command(InspectDBCommand):
  • django/contrib/gis/management/commands/ogrinspect.py

     
    1 import os, sys
     1import os
    22from optparse import make_option
    33from django.contrib.gis import gdal
    44from django.contrib.gis.management.base import ArgsCommand, CommandError
  • django/contrib/gis/feeds.py

     
    1 from django.contrib.syndication.feeds import Feed as BaseFeed, FeedDoesNotExist
     1from django.contrib.syndication.feeds import Feed as BaseFeed
    22from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
    33
    44class GeoFeedMixin(object):
  • django/contrib/formtools/wizard/storage/session.py

     
    1 from django.core.files.uploadedfile import UploadedFile
    21from django.contrib.formtools.wizard import storage
    32
    43
  • django/contrib/formtools/wizard/views.py

     
    1 import copy
    21import re
    32
    43from django import forms
  • django/contrib/formtools/utils.py

     
    55
    66import hashlib
    77from django.conf import settings
    8 from django.forms import BooleanField
    98from django.utils.crypto import salted_hmac
    109
    1110
  • django/contrib/formtools/preview.py

     
    22Formtools Preview application.
    33"""
    44
    5 try:
    6     import cPickle as pickle
    7 except ImportError:
    8     import pickle
    9 
    10 from django.conf import settings
    115from django.http import Http404
    126from django.shortcuts import render_to_response
    137from django.template.context import RequestContext
  • django/contrib/sitemaps/__init__.py

     
    1 from django.contrib.sites.models import Site, get_current_site
     1from django.contrib.sites.models import Site
    22from django.core import urlresolvers, paginator
    33from django.core.exceptions import ImproperlyConfigured
    44import urllib
  • django/contrib/admin/templatetags/admin_list.py

     
    33from django.conf import settings
    44from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
    55from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
    6     ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR)
     6    ORDER_VAR, PAGE_VAR, SEARCH_VAR)
    77from django.core.exceptions import ObjectDoesNotExist
    88from django.db import models
    99from django.utils import formats
    10 from django.utils.datastructures import SortedDict
    1110from django.utils.html import escape, conditional_escape
    1211from django.utils.safestring import mark_safe
    1312from django.utils.text import capfirst
  • django/contrib/admin/views/main.py

     
    1919# Changelist settings
    2020ALL_VAR = 'all'
    2121ORDER_VAR = 'o'
    22 ORDER_TYPE_VAR = 'ot'
    2322PAGE_VAR = 'p'
    2423SEARCH_VAR = 'q'
    2524TO_FIELD_VAR = 't'
    2625IS_POPUP_VAR = 'pop'
    2726ERROR_FLAG = 'e'
    2827
    29 IGNORED_PARAMS = (
    30     ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR, TO_FIELD_VAR)
     28IGNORED_PARAMS = (ALL_VAR, ORDER_VAR, SEARCH_VAR, IS_POPUP_VAR, TO_FIELD_VAR)
    3129
    3230# Text to display within change-list table cells if the value is blank.
    3331EMPTY_CHANGELIST_VALUE = ugettext_lazy('(None)')
  • django/contrib/auth/__init__.py

     
    1 import datetime
    21from warnings import warn
    32from django.core.exceptions import ImproperlyConfigured
    43from django.utils.importlib import import_module
  • django/contrib/auth/backends.py

     
    1 from django.db import connection
    21from django.contrib.auth.models import User, Permission
    32
    43
  • django/contrib/auth/tests/auth_backends.py

     
    1 import warnings
    2 
    31from django.conf import settings
    42from django.contrib.auth.models import User, Group, Permission, AnonymousUser
    53from django.contrib.contenttypes.models import ContentType
  • django/contrib/auth/tests/tokens.py

     
    11from datetime import date, timedelta
    22
    33from django.conf import settings
    4 from django.contrib.auth.models import User, AnonymousUser
     4from django.contrib.auth.models import User
    55from django.contrib.auth.tokens import PasswordResetTokenGenerator
    66from django.test import TestCase
    77
  • django/contrib/auth/management/__init__.py

     
    102102    :returns: The username, or an empty string if no username can be
    103103        determined.
    104104    """
    105     from django.contrib.auth.management.commands.createsuperuser import \
    106         RE_VALID_USERNAME
     105    from django.contrib.auth.management.commands.createsuperuser import (
     106        RE_VALID_USERNAME)
    107107    default_username = get_system_username()
    108108    try:
    109109        default_username = unicodedata.normalize('NFKD', default_username)\
  • django/contrib/admindocs/views.py

     
    1 from django import template, templatetags
     1import inspect
     2import os
     3import re
     4
     5from django import template
    26from django.template import RequestContext
    37from django.conf import settings
    48from django.contrib.admin.views.decorators import staff_member_required
     
    1216from django.utils.importlib import import_module
    1317from django.utils.translation import ugettext as _
    1418from django.utils.safestring import mark_safe
    15 import inspect, os, re
    1619
    1720# Exclude methods starting with these strings from documentation
    1821MODEL_METHODS_EXCLUDE = ('_', 'add_', 'delete', 'save', 'set_')
  • django/contrib/localflavor/kw/forms.py

     
    66
    77from django.core.validators import EMPTY_VALUES
    88from django.forms import ValidationError
    9 from django.forms.fields import Field, RegexField
     9from django.forms.fields import Field
    1010from django.utils.translation import gettext as _
    1111
    1212id_re = re.compile(r'^(?P<initial>\d{1})(?P<yy>\d\d)(?P<mm>\d\d)(?P<dd>\d\d)(?P<mid>\d{4})(?P<checksum>\d{1})')
  • django/contrib/localflavor/be/forms.py

     
    11"""
    22Belgium-specific Form helpers
    33"""
    4 import re
    5 
    6 from django.core.validators import EMPTY_VALUES
    7 from django.forms import ValidationError
    84from django.forms.fields import RegexField, Select
    95from django.utils.translation import ugettext_lazy as _
    106
  • django/contrib/localflavor/us/models.py

     
    1 from django.conf import settings
    21from django.utils.translation import ugettext_lazy as _
    32from django.db.models.fields import CharField
    43from django.contrib.localflavor.us.us_states import STATE_CHOICES
  • django/contrib/localflavor/uy/forms.py

     
    22"""
    33UY-specific form helpers.
    44"""
    5 import re
    6 
    75from django.core.validators import EMPTY_VALUES
    86from django.forms.fields import Select, RegexField
    97from django.forms import ValidationError
  • django/contrib/localflavor/jp/forms.py

     
    22JP-specific Form helpers
    33"""
    44
    5 from django.forms import ValidationError
    65from django.utils.translation import ugettext_lazy as _
    76from django.forms.fields import RegexField, Select
    87
  • django/contrib/localflavor/no/forms.py

     
    22Norwegian-specific Form helpers
    33"""
    44
    5 import re, datetime
     5import re
     6import datetime
    67from django.core.validators import EMPTY_VALUES
    78from django.forms import ValidationError
    89from django.forms.fields import Field, RegexField, Select
  • django/contrib/localflavor/ro/forms.py

     
    22"""
    33Romanian specific form helpers.
    44"""
    5 
    6 import re
    7 
    85from django.core.validators import EMPTY_VALUES
    96from django.forms import ValidationError, Field, RegexField, Select
    107from django.utils.translation import ugettext_lazy as _
  • django/contrib/localflavor/pt/forms.py

     
    11"""
    22PT-specific Form helpers
    33"""
     4import re
    45
    56from django.core.validators import EMPTY_VALUES
    67from django.forms import ValidationError
    7 from django.forms.fields import Field, RegexField, Select
     8from django.forms.fields import Field, RegexField
    89from django.utils.encoding import smart_unicode
    910from django.utils.translation import ugettext_lazy as _
    10 import re
    1111
    1212phone_digits_re = re.compile(r'^(\d{9}|(00|\+)\d*)$')
    1313
  • django/contrib/localflavor/ru/forms.py

     
    33"""
    44import re
    55
    6 from django.core.validators import EMPTY_VALUES
    7 from django.forms import ValidationError
    8 from django.forms.fields import CharField, Select, RegexField
     6from django.forms.fields import RegexField, Select
    97from django.utils.translation import ugettext_lazy as _
    108
    119phone_digits_re = re.compile(r'^(?:[78]-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
  • django/contrib/localflavor/ar/forms.py

     
    66from django.forms import ValidationError
    77from django.core.validators import EMPTY_VALUES
    88from django.forms.fields import RegexField, CharField, Select
    9 from django.utils.encoding import smart_unicode
    109from django.utils.translation import ugettext_lazy as _
    1110
    1211class ARProvinceSelect(Select):
  • django/contrib/localflavor/in_/forms.py

     
    77from django.forms.fields import Field, RegexField, Select
    88from django.utils.encoding import smart_unicode
    99from django.utils.translation import gettext
    10 import re
    1110
    1211
    1312class INZipCodeField(RegexField):
  • django/contrib/localflavor/au/models.py

     
    1 from django.conf import settings
    21from django.utils.translation import ugettext_lazy as _
    32from django.db.models.fields import CharField
    43
  • django/contrib/localflavor/se/utils.py

     
    1 import re
    21import datetime
    32
    43def id_number_checksum(gd):
  • django/contrib/sessions/backends/base.py

     
    22import hashlib
    33import os
    44import random
    5 import sys
    65import time
    76from datetime import datetime, timedelta
    87try:
  • django/contrib/sessions/backends/db.py

     
    11import datetime
    2 from django.conf import settings
    32from django.contrib.sessions.backends.base import SessionBase, CreateError
    43from django.core.exceptions import SuspiciousOperation
    54from django.db import IntegrityError, transaction, router
  • django/contrib/sessions/models.py

     
    1 import base64
    2 import cPickle as pickle
    3 
    41from django.db import models
    52from django.utils.translation import ugettext_lazy as _
    63
  • django/contrib/messages/api.py

     
    11from django.contrib.messages import constants
    22from django.contrib.messages.storage import default_storage
    3 from django.utils.functional import lazy, memoize
    43
    54__all__ = (
    65    'add_message', 'get_messages',
  • django/contrib/messages/tests/cookie.py

     
    11from django.contrib.messages import constants
    22from django.contrib.messages.tests.base import BaseTest
    3 from django.contrib.messages.storage.cookie import CookieStorage, \
    4                                             MessageEncoder, MessageDecoder
     3from django.contrib.messages.storage.cookie import (CookieStorage,
     4    MessageEncoder, MessageDecoder)
    55from django.contrib.messages.storage.base import Message
    66from django.utils import simplejson as json
    77from django.conf import settings
  • django/contrib/messages/tests/base.py

     
    1 import warnings
    2 
    31from django import http
    42from django.test import TestCase
    53from django.conf import settings
  • django/contrib/messages/tests/fallback.py

     
    11from django.contrib.messages import constants
    2 from django.contrib.messages.storage.fallback import FallbackStorage, \
    3     CookieStorage
     2from django.contrib.messages.storage.fallback import (FallbackStorage,
     3    CookieStorage)
    44from django.contrib.messages.tests.base import BaseTest
    5 from django.contrib.messages.tests.cookie import set_cookie_data, \
    6     stored_cookie_messages_count
    7 from django.contrib.messages.tests.session import set_session_data, \
    8     stored_session_messages_count
     5from django.contrib.messages.tests.cookie import (set_cookie_data,
     6    stored_cookie_messages_count)
     7from django.contrib.messages.tests.session import (set_session_data,
     8    stored_session_messages_count)
    99
    1010
    1111class FallbackTest(BaseTest):
  • django/contrib/messages/tests/urls.py

     
    22from django.contrib import messages
    33from django.core.urlresolvers import reverse
    44from django.http import HttpResponseRedirect, HttpResponse
    5 from django.shortcuts import render_to_response, redirect
    65from django.template import RequestContext, Template
    76from django.template.response import TemplateResponse
    87from django.views.decorators.cache import never_cache
  • django/contrib/messages/storage/cookie.py

     
    11from django.conf import settings
    2 from django.contrib.messages import constants
    32from django.contrib.messages.storage.base import BaseStorage, Message
    43from django.http import SimpleCookie
    54from django.utils import simplejson as json
  • django/utils/translation/trans_real.py

     
    44import os
    55import re
    66import sys
    7 import warnings
    87import gettext as gettext_module
    9 from cStringIO import StringIO
     8try:
     9    from cStringIO import StringIO
     10except ImportError:
     11    from StringIO import StringIO
    1012from threading import local
    1113
    1214from django.utils.importlib import import_module
  • django/utils/translation/trans_null.py

     
    22# that don't actually do anything. This is purely for performance, so that
    33# settings.USE_I18N = False can use this module rather than trans_real.py.
    44
    5 import warnings
    65from django.conf import settings
    76from django.utils.encoding import force_unicode
    87from django.utils.safestring import mark_safe, SafeData
  • django/utils/unittest/compatibility.py

     
    11import os
    22import sys
    33
    4 try:
    5     from functools import wraps
    6 except ImportError:
    7     # only needed for Python 2.4
    8     def wraps(_):
    9         def _wraps(func):
    10             return func
    11         return _wraps
     4# Backwards compatibility: Django used to re-define `wraps` for Python 2.4.
     5from functools import wraps
    126
    137__unittest = True
    148
  • django/utils/unittest/case.py

     
    1212    safe_repr, safe_str, strclass,\
    1313    unorderable_list_difference
    1414
    15 from django.utils.unittest.compatibility import wraps
     15from functools import wraps
    1616
    1717__unittest = True
    1818
  • django/utils/unittest/result.py

     
    77from StringIO import StringIO
    88
    99from django.utils.unittest import util
    10 from django.utils.unittest.compatibility import wraps
     10from functools import wraps
    1111
    1212__unittest = True
    1313
  • django/utils/unittest/__init__.py

     
    5252
    5353        from django.utils.unittest.collector import collector
    5454        from django.utils.unittest.result import TestResult
    55         from django.utils.unittest.case import \
    56             TestCase, FunctionTestCase, SkipTest, skip, skipIf,\
    57             skipUnless, expectedFailure
     55        from django.utils.unittest.case import (TestCase, FunctionTestCase,
     56            SkipTest, skip, skipIf, skipUnless, expectedFailure)
    5857
    5958        from django.utils.unittest.suite import BaseTestSuite, TestSuite
    60         from django.utils.unittest.loader import \
    61             TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,\
    62             findTestCases
     59        from django.utils.unittest.loader import (TestLoader, defaultTestLoader,
     60            makeSuite, getTestCaseNames, findTestCases)
    6361
    6462        from django.utils.unittest.main import TestProgram, main, main_
    6563        from django.utils.unittest.runner import TextTestRunner, TextTestResult
    6664
    6765        try:
    68             from django.utils.unittest.signals import\
    69                 installHandler, registerResult, removeResult, removeHandler
     66            from django.utils.unittest.signals import (installHandler,
     67                registerResult, removeResult, removeHandler)
    7068        except ImportError:
    7169            # Compatibility with platforms that don't have the signal module
    7270            pass
  • django/utils/unittest/signals.py

     
    11import signal
    22import weakref
    33
    4 from django.utils.unittest.compatibility import wraps
     4from functools import wraps
    55
    66__unittest = True
    77
  • django/utils/functional.py

     
    11import operator
    2 from functools import wraps, update_wrapper
     2from functools import wraps
    33
    44
    55# You can't trivially replace this `functools.partial` because this binds to
  • django/utils/cache.py

     
    2626from django.utils.encoding import smart_str, iri_to_uri
    2727from django.utils.http import http_date
    2828from django.utils.translation import get_language
    29 from django.http import HttpRequest
    3029
    3130cc_delim_re = re.compile(r'\s*,\s*')
    3231
  • django/utils/timesince.py

     
    11import datetime
    2 import time
    32
    43from django.utils.tzinfo import LocalTimezone
    54from django.utils.translation import ungettext, ugettext
  • django/utils/log.py

     
    11import logging
    2 import sys
    32import traceback
    43
    54from django.conf import settings
  • django/utils/text.py

     
    180180# From http://www.xhaus.com/alan/python/httpcomp.html#gzip
    181181# Used with permission.
    182182def compress_string(s):
    183     import cStringIO, gzip
    184     zbuf = cStringIO.StringIO()
    185     zfile = gzip.GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
     183    from gzip import GzipFile
     184    try:
     185        from cStringIO import StringIO
     186    except ImportError:
     187        from StringIO import StringIO
     188    zbuf = StringIO()
     189    zfile = GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
    186190    zfile.write(s)
    187191    zfile.close()
    188192    return zbuf.getvalue()
  • django/utils/version.py

     
    11import django
    2 import os.path
    32import re
    43
    54def get_svn_revision(path=None):
  • django/bin/profiling/gather_profile_stats.py

     
    88"""
    99
    1010from hotshot import stats
     11import os
    1112import pstats
    12 import sys, os
     13import sys
    1314
    1415def gather_stats(p):
    1516    profiles = {}
  • django/template/base.py

     
    1 import imp
    21import re
    32from functools import partial
    43from inspect import getargspec
     
    76from django.template.context import Context, RequestContext, ContextPopException
    87from django.utils.importlib import import_module
    98from django.utils.itercompat import is_iterable
    10 from django.utils.functional import Promise
    119from django.utils.text import smart_split, unescape_string_literal, get_text_list
    1210from django.utils.encoding import smart_unicode, force_unicode, smart_str
    1311from django.utils.translation import ugettext_lazy
  • django/template/loaders/cached.py

     
    44"""
    55
    66import hashlib
    7 from django.core.exceptions import ImproperlyConfigured
    87from django.template.base import TemplateDoesNotExist
    98from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_origin
    10 from django.utils.importlib import import_module
    119
    1210class Loader(BaseLoader):
    1311    is_usable = True
  • django/template/defaulttags.py

     
    55from datetime import datetime
    66from itertools import groupby, cycle as itertools_cycle
    77
    8 from django.template.base import Node, NodeList, Template, Context, Variable
    9 from django.template.base import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END
     8from django.template.base import Node, NodeList, Template
     9from django.template.base import (TemplateSyntaxError, VariableDoesNotExist,
     10        BLOCK_TAG_START, BLOCK_TAG_END,
     11        VARIABLE_TAG_START, VARIABLE_TAG_END,
     12        SINGLE_BRACE_START, SINGLE_BRACE_END,
     13        COMMENT_TAG_START, COMMENT_TAG_END)
    1014from django.template.base import get_library, Library, InvalidTemplateLibrary
    1115from django.template.smartif import IfParser, Literal
    1216from django.template.defaultfilters import date
  • django/template/context.py

     
    11from copy import copy
    22from django.core.exceptions import ImproperlyConfigured
    33from django.utils.importlib import import_module
    4 from django.http import HttpRequest
    54
    65# Cache of actual callables.
    76_standard_context_processors = None
  • django/template/loader_tags.py

     
    1 from django.template.base import TemplateSyntaxError, TemplateDoesNotExist, Variable
    2 from django.template.base import Library, Node, TextNode
    3 from django.template.context import Context
     1from django.template.base import TemplateSyntaxError, Library, Node, TextNode
    42from django.template.defaulttags import token_kwargs
    53from django.template.loader import get_template
    64from django.conf import settings
  • django/template/smartif.py

     
    11"""
    22Parser and utilities for the smart 'if' tag
    33"""
    4 import operator
    54
    65# Using a simple top down parser, as described here:
    76#    http://effbot.org/zone/simple-top-down-parsing.htm.
  • django/template/debug.py

     
    1 from django.conf import settings
    21from django.template.base import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError
    32from django.utils.encoding import force_unicode
    43from django.utils.html import escape
  • django/middleware/http.py

     
    1 from django.core.exceptions import MiddlewareNotUsed
    21from django.utils.http import http_date, parse_http_date_safe
    32
    43class ConditionalGetMiddleware(object):
  • tests/modeltests/field_subclassing/models.py

     
    55from django.db import models
    66from django.utils.encoding import force_unicode
    77
    8 from fields import Small, SmallField, SmallerField, JSONField
     8from fields import SmallField, SmallerField, JSONField
    99
    1010
    1111class MyModel(models.Model):
  • tests/modeltests/field_subclassing/fields.py

     
    1 from django.core.exceptions import FieldError
    21from django.db import models
    32from django.utils import simplejson as json
    43from django.utils.encoding import force_unicode
  • tests/modeltests/proxy_models/models.py

     
    55providing a modified interface to the data from the base class.
    66"""
    77
    8 from django.contrib.contenttypes.models import ContentType
    98from django.db import models
    109
    1110
  • tests/modeltests/mutually_referential/tests.py

     
    11from django.test import TestCase
    2 from models import Parent, Child
     2from models import Parent
    33
    44class MutuallyReferentialTests(TestCase):
    55
  • tests/modeltests/get_or_create/models.py

     
    66parameters.
    77"""
    88
    9 from django.db import models, IntegrityError
     9from django.db import models
    1010
    1111class Person(models.Model):
    1212    first_name = models.CharField(max_length=100)
  • tests/modeltests/files/tests.py

     
    11from __future__ import with_statement
    22
    33import shutil
    4 import sys
    54import tempfile
    65
    76from django.core.cache import cache
  • tests/modeltests/files/models.py

     
    99import tempfile
    1010
    1111from django.db import models
    12 from django.core.files.base import ContentFile
    1312from django.core.files.storage import FileSystemStorage
    1413
    1514
  • tests/modeltests/unmanaged_models/tests.py

     
    11from django.test import TestCase
    22from django.db import connection
    3 from models import Unmanaged1, Unmanaged2, Managed1
    4 from models import A01, A02, B01, B02, C01, C02
     3from models import A01, A02, B01, B02, C01, C02, Unmanaged2, Managed1
    54
    65class SimpleTests(TestCase):
    76
  • tests/modeltests/custom_pk/tests.py

     
    11# -*- coding: utf-8 -*-
    2 from django.conf import settings
    3 from django.db import DEFAULT_DB_ALIAS, transaction, IntegrityError
     2from django.db import transaction, IntegrityError
    43from django.test import TestCase, skipIfDBFeature
    54
    65from models import Employee, Business, Bar, Foo
  • tests/modeltests/custom_pk/models.py

     
    66this behavior by explicitly adding ``primary_key=True`` to a field.
    77"""
    88
    9 from django.conf import settings
    10 from django.db import models, transaction, IntegrityError, DEFAULT_DB_ALIAS
     9from django.db import models
    1110
    1211from fields import MyAutoField
    1312
  • tests/modeltests/lookup/tests.py

     
    11from datetime import datetime
    22from operator import attrgetter
    33from django.core.exceptions import FieldError
    4 from django.db import connection
    54from django.test import TestCase, skipUnlessDBFeature
    65from models import Author, Article, Tag
    76
  • tests/modeltests/lookup/models.py

     
    44This demonstrates features of the database API.
    55"""
    66
    7 from django.db import models, DEFAULT_DB_ALIAS, connection
    8 from django.conf import settings
     7from django.db import models
    98
    109class Author(models.Model):
    1110    name = models.CharField(max_length=100)
  • tests/modeltests/proxy_model_inheritance/tests.py

     
    99import os
    1010import sys
    1111
    12 from django.conf import settings, Settings
     12from django.conf import settings
    1313from django.core.management import call_command
    1414from django.db.models.loading import load_app
    1515from django.test import TransactionTestCase
  • tests/modeltests/get_object_or_404/models.py

     
    1111"""
    1212
    1313from django.db import models
    14 from django.http import Http404
    15 from django.shortcuts import get_object_or_404, get_list_or_404
    1614
    1715class Author(models.Model):
    1816    name = models.CharField(max_length=50)
  • tests/modeltests/delete/models.py

     
    1 from django.db import models, IntegrityError
     1from django.db import models
    22
    33
    44class R(models.Model):
  • tests/modeltests/fixtures_model_package/models/__init__.py

     
    11from django.db import models
    2 from django.conf import settings
    32
    43class Article(models.Model):
    54    headline = models.CharField(max_length=100, default='Default headline')
  • tests/modeltests/model_forms/models.py

     
    77words, most of these tests should be rewritten.
    88"""
    99
    10 import os
    1110import tempfile
    1211
    1312from django.db import models
  • tests/modeltests/basic/tests.py

     
    11from datetime import datetime
    22
    33from django.core.exceptions import ObjectDoesNotExist
    4 from django.db import models, DEFAULT_DB_ALIAS, connection
    54from django.db.models.fields import FieldDoesNotExist
    65from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
    76
  • tests/modeltests/basic/models.py

     
    44
    55This is a basic model with only two non-primary-key fields.
    66"""
    7 from django.db import models, DEFAULT_DB_ALIAS, connection
     7from django.db import models
    88
    99class Article(models.Model):
    1010    headline = models.CharField(max_length=100, default='Default headline')
  • tests/modeltests/one_to_one/models.py

     
    66In this example, a ``Place`` optionally can be a ``Restaurant``.
    77"""
    88
    9 from django.db import models, transaction, IntegrityError
     9from django.db import models
    1010
    1111class Place(models.Model):
    1212    name = models.CharField(max_length=50)
  • tests/modeltests/force_insert_update/models.py

     
    22Tests for forcing insert and update queries (instead of Django's normal
    33automatic behaviour).
    44"""
    5 from django.db import models, transaction, IntegrityError
     5from django.db import models
    66
    77class Counter(models.Model):
    88    name = models.CharField(max_length = 10)
  • tests/modeltests/validation/validators.py

     
    1 from django.utils.unittest import TestCase
    2 
    31from modeltests.validation import ValidationTestCase
    42from models import *
    53
  • tests/modeltests/validation/models.py

     
    11from datetime import datetime
    22from django.core.exceptions import ValidationError
    33from django.db import models
    4 from django.test import TestCase
    54
    65
    76def validate_answer_to_universe(value):
  • tests/modeltests/m2m_through/tests.py

     
    33
    44from django.test import TestCase
    55
    6 from models import Person, Group, Membership, CustomMembership, \
    7     TestNoDefaultsOrNulls, PersonSelfRefM2M, Friendship
     6from models import (Person, Group, Membership, CustomMembership,
     7    PersonSelfRefM2M, Friendship)
    88
    99
    1010class M2mThroughTests(TestCase):
  • tests/modeltests/transactions/tests.py

     
    11from __future__ import with_statement
    22
    3 import sys
    4 
    5 from django.db import connection, transaction, IntegrityError, DEFAULT_DB_ALIAS
    6 from django.conf import settings
     3from django.db import connection, transaction, IntegrityError
    74from django.test import TransactionTestCase, skipUnlessDBFeature
    85
    96from models import Reporter
  • tests/modeltests/transactions/models.py

     
    77manually.
    88"""
    99
    10 from django.db import models, DEFAULT_DB_ALIAS
     10from django.db import models
    1111
    1212class Reporter(models.Model):
    1313    first_name = models.CharField(max_length=30)
  • tests/modeltests/model_formsets/tests.py

     
    1010from django.test import TestCase, skipUnlessDBFeature
    1111
    1212from modeltests.model_formsets.models import (
    13     Author, BetterAuthor, Book, BookWithCustomPK, Editor,
     13    Author, BetterAuthor, Book, BookWithCustomPK,
    1414    BookWithOptionalAltEditor, AlternateBook, AuthorMeeting, CustomPrimaryKey,
    1515    Place, Owner, Location, OwnerProfile, Restaurant, Product, Price,
    1616    MexicanRestaurant, ClassyMexicanRestaurant, Repository, Revision,
  • tests/modeltests/pagination/tests.py

     
    11from datetime import datetime
    2 from operator import attrgetter
    32
    43from django.core.paginator import Paginator, InvalidPage, EmptyPage
    54from django.test import TestCase
  • tests/modeltests/serializers/tests.py

     
    99from django.test import TestCase, TransactionTestCase, Approximate
    1010from django.utils import simplejson, unittest
    1111
    12 from models import Category, Author, Article, AuthorProfile, Actor, \
    13                                     Movie, Score, Player, Team
     12from models import Category, Author, Article, AuthorProfile, Actor, Movie, Score, Player, Team
    1413
    1514class SerializerRegistrationTests(unittest.TestCase):
    1615    def setUp(self):
  • tests/modeltests/fixtures/tests.py

     
    11import StringIO
    2 import sys
    32
    4 from django.conf import settings
    53from django.contrib.sites.models import Site
    64from django.core import management
    7 from django.db import DEFAULT_DB_ALIAS
    85from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature
    96
    10 from models import Article, Blog, Book, Category, Person, Spy, Tag, Visa
     7from models import Article, Book, Spy, Tag, Visa
    118
    129
    1310class TestCaseFixtureLoadingTests(TestCase):
  • tests/modeltests/fixtures/models.py

     
    1111from django.contrib.auth.models import Permission
    1212from django.contrib.contenttypes import generic
    1313from django.contrib.contenttypes.models import ContentType
    14 from django.db import models, DEFAULT_DB_ALIAS
    15 from django.conf import settings
     14from django.db import models
    1615
    1716
    1817class Category(models.Model):
  • tests/regressiontests/defer_regress/tests.py

     
    11from operator import attrgetter
    22
    3 from django.conf import settings
    43from django.contrib.contenttypes.models import ContentType
    54from django.contrib.sessions.backends.db import SessionStore
    6 from django.db import connection
    75from django.db.models.loading import cache
    86from django.test import TestCase
    97
  • tests/regressiontests/defer_regress/models.py

     
    22Regression tests for defer() / only() behavior.
    33"""
    44
    5 from django.conf import settings
    6 from django.contrib.contenttypes.models import ContentType
    7 from django.db import connection, models
     5from django.db import models
    86
    97class Item(models.Model):
    108    name = models.CharField(max_length=15)
  • tests/regressiontests/admin_filters/tests.py

     
    1 from __future__ import with_statement
    2 
    31import datetime
    42
    53from django.core.exceptions import ImproperlyConfigured
  • tests/regressiontests/test_utils/tests.py

     
    11from __future__ import with_statement
    22
    3 import sys
    4 
    5 from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
     3from django.test import TestCase, skipUnlessDBFeature
    64from django.utils.unittest import skip
    75
    86from models import Person
  • tests/regressiontests/multiple_database/tests.py

     
    11import datetime
    22import pickle
    3 import sys
    43from StringIO import StringIO
    54
    65from django.conf import settings
     
    87from django.core import management
    98from django.db import connections, router, DEFAULT_DB_ALIAS
    109from django.db.models import signals
    11 from django.db.utils import ConnectionRouter
    1210from django.test import TestCase
    1311
    1412from models import Book, Person, Pet, Review, UserProfile
  • tests/regressiontests/multiple_database/models.py

     
    1 from django.conf import settings
    21from django.contrib.auth.models import User
    32from django.contrib.contenttypes.models import ContentType
    43from django.contrib.contenttypes import generic
  • tests/regressiontests/select_related_onetoone/tests.py

     
    1 from django import db
    2 from django.conf import settings
    31from django.test import TestCase
    42
    53from models import (User, UserProfile, UserStat, UserStatResult, StatDetails,
  • tests/regressiontests/delete_regress/tests.py

     
    11import datetime
    22
    33from django.conf import settings
    4 from django.db import backend, connection, transaction, DEFAULT_DB_ALIAS
     4from django.db import backend, transaction, DEFAULT_DB_ALIAS
    55from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature
    66
    77from models import (Book, Award, AwardNote, Person, Child, Toy, PlayedWith,
    8     PlayedWithNote, Contact, Email, Researcher, Food, Eaten,
     8    PlayedWithNote, Email, Researcher, Food, Eaten,
    99    Policy, Version, Location, Item)
    1010
    1111
  • tests/regressiontests/views/tests/debug.py

     
    99from django.core.urlresolvers import reverse
    1010from django.template import TemplateSyntaxError
    1111from django.views.debug import ExceptionReporter
    12 from django.core.exceptions import ImproperlyConfigured
    1312from django.core import mail
    1413
    1514from regressiontests.views import BrokenException, except_args
  • tests/regressiontests/views/tests/defaults.py

     
    1 from os import path
    2 
    3 from django.conf import settings
    41from django.test import TestCase
    52from django.contrib.contenttypes.models import ContentType
    63
  • tests/regressiontests/model_forms_regress/tests.py

     
    88from django.utils import unittest
    99from django.test import TestCase
    1010
    11 from models import Person, RealPerson, Triple, FilePathModel, Article, \
    12     Publication, CustomFF, Author, Author1, Homepage, Document, Edition
     11from models import (Person, RealPerson, Triple, FilePathModel, Article,
     12    Publication, CustomFF, Author, Author1, Homepage, Document, Edition)
    1313
    1414
    1515class ModelMultipleChoiceFieldTests(TestCase):
  • tests/regressiontests/admin_validation/tests.py

     
    11from django.contrib import admin
    22from django import forms
    3 from django.contrib.admin.validation import validate, validate_inline, \
    4                                             ImproperlyConfigured
     3from django.contrib.admin.validation import validate, validate_inline, ImproperlyConfigured
    54from django.test import TestCase
    65
    76from models import Song, Book, Album, TwoAlbumFKAndAnE, State, City
  • tests/regressiontests/file_storage/tests.py

     
    1818
    1919from django.conf import settings
    2020from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
    21 from django.core.files.base import ContentFile, File
     21from django.core.files.base import ContentFile
    2222from django.core.files.images import get_image_dimensions
    2323from django.core.files.storage import FileSystemStorage, get_storage_class
    2424from django.core.files.uploadedfile import UploadedFile
  • tests/regressiontests/expressions_regress/tests.py

     
    33"""
    44import datetime
    55
    6 from django.conf import settings
    7 from django.db import models, connection
     6from django.db import connection
    87from django.db.models import F
    98from django.test import TestCase, Approximate, skipUnlessDBFeature
    109
  • tests/regressiontests/generic_inline_admin/tests.py

     
    55from django.test import TestCase
    66
    77# local test models
    8 from models import Episode, EpisodeExtra, EpisodeMaxNum, EpisodeExclude, \
    9                    Media, EpisodePermanent, MediaPermanentInline, Category
     8from models import (Episode, EpisodeExtra, EpisodeMaxNum, EpisodeExclude,
     9    Media, EpisodePermanent, MediaPermanentInline, Category)
    1010
    1111
    1212class GenericAdminViewTest(TestCase):
  • tests/regressiontests/comment_tests/tests/templatetag_tests.py

     
    11from django.contrib.comments.forms import CommentForm
    2 from django.contrib.comments.models import Comment
    32from django.contrib.contenttypes.models import ContentType
    43from django.template import Template, Context
    54from regressiontests.comment_tests.models import Article, Author
  • tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py

     
    1 from regressiontests.comment_tests.tests import CommentTestCase, CT, Site
    2 from django.contrib.comments.forms import CommentForm
     1from regressiontests.comment_tests.tests import CommentTestCase
    32from django.contrib.comments.models import Comment
    43from django.contrib.comments.moderation import moderator, CommentModerator, AlreadyModerated
    54from regressiontests.comment_tests.models import Entry
  • tests/regressiontests/comment_tests/tests/feed_tests.py

     
    1 import warnings
    2 
    3 from django.test.utils import get_warnings_state, restore_warnings_state
    4 
    51from regressiontests.comment_tests.tests import CommentTestCase
    62
    73
  • tests/regressiontests/syndication/tests.py

     
    1 import datetime
    2 import warnings
    31from xml.dom import minidom
    42
    53from django.contrib.syndication import views
  • tests/regressiontests/m2m_through_regress/models.py

     
    1 from datetime import datetime
    2 
    31from django.contrib.auth.models import User
    4 from django.core import management
    52from django.db import models
    63
    74
  • tests/regressiontests/signals_regress/tests.py

     
    1 import sys
    2 from StringIO import StringIO
    31from django.test import TestCase
    42
    53from django.db import models
  • tests/regressiontests/datatypes/tests.py

     
    11import datetime
    22
    3 from django.conf import settings
    4 from django.db import DEFAULT_DB_ALIAS
    53from django.test import TestCase, skipIfDBFeature
    64from django.utils import tzinfo
    75
  • tests/regressiontests/localflavor/tests.py

     
    1 from django.test import TestCase
    2 from django.utils import unittest
    3 
    4 # just import your tests here
    51from us.tests import *
    62from au.tests import *
  • tests/regressiontests/modeladmin/models.py

     
    11# coding: utf-8
    2 from datetime import date
    3 
    42from django.db import models
    53from django.contrib.auth.models import User
    64
  • tests/regressiontests/max_lengths/tests.py

     
    1 from django.db import DatabaseError
    21from django.utils import unittest
    32from regressiontests.max_lengths.models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
    43
  • tests/regressiontests/extra_regress/tests.py

     
    33from django.utils.datastructures import SortedDict
    44
    55from django.contrib.auth.models import User
    6 from regressiontests.extra_regress.models import TestObject, Order, \
    7         RevisionableModel
     6from regressiontests.extra_regress.models import TestObject, Order, RevisionableModel
    87
    98import datetime
    109
  • tests/regressiontests/middleware_exceptions/models.py

     
    1 from django.db import models
  • tests/regressiontests/i18n/tests.py

     
    33import datetime
    44import decimal
    55import os
    6 import sys
    76import pickle
    87from threading import local
    98
  • tests/regressiontests/i18n/forms.py

     
    1 from django import template, forms
     1from django import forms
    22from django.forms.extras import SelectDateWidget
    33from models import Company
    44
  • tests/regressiontests/csrf_tests/tests.py

     
    11# -*- coding: utf-8 -*-
    22from __future__ import with_statement
    3 import warnings
    43
    54from django.test import TestCase
    65from django.http import HttpRequest, HttpResponse
  • tests/regressiontests/settings_tests/tests.py

     
    11from __future__ import with_statement
    2 import os, sys
     2import os
    33from django.conf import settings, global_settings
    44from django.test import TestCase, signals
    55from django.test.utils import override_settings
    6 from django.utils.unittest import skipIf
    76
    87
    98class SettingGetter(object):
  • tests/regressiontests/model_fields/tests.py

     
    1212
    1313# If PIL available, do these tests.
    1414if Image:
    15     from imagefield import \
    16             ImageFieldTests, \
    17             ImageFieldTwoDimensionsTests, \
    18             ImageFieldNoDimensionsTests, \
    19             ImageFieldOneDimensionTests, \
    20             ImageFieldDimensionsFirstTests, \
    21             ImageFieldUsingFileTests, \
    22             TwoImageFieldTests
     15    from imagefield import (
     16            ImageFieldTests,
     17            ImageFieldTwoDimensionsTests,
     18            ImageFieldNoDimensionsTests,
     19            ImageFieldOneDimensionTests,
     20            ImageFieldDimensionsFirstTests,
     21            ImageFieldUsingFileTests,
     22            TwoImageFieldTests)
    2323
    2424
    2525class BasicFieldTests(test.TestCase):
  • tests/regressiontests/model_fields/imagefield.py

     
    22import shutil
    33
    44from django.core.files import File
    5 from django.core.files.base import ContentFile
    65from django.core.files.images import ImageFile
    76from django.test import TestCase
    87
    9 from models import Image, Person, PersonWithHeight, PersonWithHeightAndWidth, \
    10         PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile
     8from models import (Image, Person, PersonWithHeight, PersonWithHeightAndWidth,
     9        PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile)
    1110
    1211
    1312# If PIL available, do these tests.
  • tests/regressiontests/generic_relations_regress/tests.py

     
    11from django.test import TestCase
    2 from django.contrib.contenttypes.models import ContentType
    32from django.db.models import Q
    43from models import *
    54
  • tests/regressiontests/forms/tests/models.py

     
    33from django.core.files.uploadedfile import SimpleUploadedFile
    44from django.forms import Form, ModelForm, FileField, ModelChoiceField
    55from django.test import TestCase
    6 from regressiontests.forms.models import ChoiceModel, ChoiceOptionModel, ChoiceFieldModel, FileModel, Group, BoundaryModel, Defaults
     6from regressiontests.forms.models import (ChoiceOptionModel, ChoiceFieldModel,
     7    FileModel, Group, BoundaryModel, Defaults)
    78
    89
    910class ChoiceFieldForm(ModelForm):
  • tests/regressiontests/forms/tests/fields.py

     
    2525__init__(). For example, CharField has a max_length option.
    2626"""
    2727import datetime
    28 import time
    2928import re
    3029import os
    3130import urllib2
     
    3332
    3433from django.core.files.uploadedfile import SimpleUploadedFile
    3534from django.forms import *
    36 from django.forms.widgets import RadioFieldRenderer
    3735from django.utils.unittest import TestCase
    3836
    3937
  • tests/regressiontests/forms/tests/forms.py

     
    11# -*- coding: utf-8 -*-
    22import datetime
    3 from decimal import Decimal
    4 import re
    5 import time
    63from django.core.files.uploadedfile import SimpleUploadedFile
    74from django.forms import *
    85from django.http import QueryDict
  • tests/regressiontests/forms/tests/widgets.py

     
    22
    33import copy
    44import datetime
    5 import re
    6 import time
    7 from decimal import Decimal
    85from django.conf import settings
    96from django.core.files.uploadedfile import SimpleUploadedFile
    107from django.forms import *
  • tests/regressiontests/forms/localflavor/cl.py

     
    11from django.contrib.localflavor.cl.forms import CLRutField, CLRegionSelect
    2 from django.core.exceptions import ValidationError
    32
    43from utils import LocalFlavorTestCase
    54
  • tests/regressiontests/serializers_regress/tests.py

     
    1515except ImportError:
    1616    from StringIO import StringIO
    1717
    18 from django.conf import settings
    19 from django.core import serializers, management
     18from django.core import serializers
    2019from django.core.serializers import SerializerDoesNotExist
    21 from django.db import transaction, DEFAULT_DB_ALIAS, connection
     20from django.db import connection
    2221from django.test import TestCase
    2322from django.utils.functional import curry
    2423
  • tests/regressiontests/generic_views/base.py

     
    44from django.core.exceptions import ImproperlyConfigured
    55from django.http import HttpResponse
    66from django.test import TestCase, RequestFactory
    7 from django.utils import simplejson
    87from django.views.generic import View, TemplateView, RedirectView
    98
    109
  • tests/regressiontests/generic_views/list.py

     
    22from django.test import TestCase
    33
    44from regressiontests.generic_views.models import Author, Artist
    5 from regressiontests.generic_views.views import CustomPaginator
    65
    76class ListViewTests(TestCase):
    87    fixtures = ['generic-views-test-data.json']
  • tests/regressiontests/generic_views/dates.py

     
    11import datetime
    2 import random
    32
    43from django.core.exceptions import ImproperlyConfigured
    54from django.test import TestCase
  • tests/regressiontests/templates/loaders.py

     
    1414import imp
    1515import StringIO
    1616import os.path
    17 import warnings
    1817
    1918from django.template import TemplateDoesNotExist, Context
    2019from django.template.loaders.eggs import Loader as EggLoader
    2120from django.template import loader
    22 from django.test.utils import get_warnings_state, restore_warnings_state
    2321from django.utils import unittest
    2422
    2523
  • tests/regressiontests/templates/response.py

     
    66from django.test import RequestFactory, TestCase
    77from django.conf import settings
    88import django.template.context
    9 from django.template import Template, Context, RequestContext
     9from django.template import Template, Context
    1010from django.template.response import (TemplateResponse, SimpleTemplateResponse,
    1111                                      ContentNotRenderedError)
    1212
  • tests/regressiontests/templates/tests.py

     
    1414import warnings
    1515
    1616from django import template
    17 from django.template import base as template_base
     17from django.template import base as template_base, RequestContext
    1818from django.core import urlresolvers
    1919from django.template import loader
    2020from django.template.loaders import app_directories, filesystem, cached
    21 from django.test.utils import get_warnings_state, restore_warnings_state,\
    22     setup_test_template_loader, restore_template_loaders
     21from django.test.utils import (get_warnings_state, restore_warnings_state,
     22    setup_test_template_loader, restore_template_loaders)
    2323from django.utils import unittest
    2424from django.utils.formats import date_format
    2525from django.utils.translation import activate, deactivate, ugettext as _
  • tests/regressiontests/templates/smartif.py

     
    1 from django.template.smartif import IfParser, Literal
     1from django.template.smartif import IfParser
    22from django.utils import unittest
    33
    44class SmartIfTests(unittest.TestCase):
  • tests/regressiontests/templates/custom.py

     
    1 from __future__ import with_statement
    2 
    31from django import template
    42from django.utils.unittest import TestCase
    53from templatetags import custom
  • tests/regressiontests/introspection/tests.py

     
    11from functools import update_wrapper
    2 from django.conf import settings
    3 from django.db import connection, DEFAULT_DB_ALIAS
     2from django.db import connection
    43from django.test import TestCase, skipUnlessDBFeature
    54
    65from models import Reporter, Article
  • tests/regressiontests/utils/jslex.py

     
    22# encoding: utf-8
    33# originally from https://bitbucket.org/ned/jslex
    44
    5 import difflib
    65from django.test import TestCase
    76from django.utils.jslex import JsLexer, prepare_js_for_gettext
    87
  • tests/regressiontests/fixtures_regress/tests.py

     
    22# Unittests for fixtures.
    33import os
    44import re
    5 import sys
    65try:
    76    from cStringIO import StringIO
    87except ImportError:
     
    1312from django.core.management.base import CommandError
    1413from django.db.models import signals
    1514from django.db import transaction
    16 from django.test import TestCase, TransactionTestCase, skipIfDBFeature, \
    17     skipUnlessDBFeature
     15from django.test import (TestCase, TransactionTestCase, skipIfDBFeature,
     16    skipUnlessDBFeature)
    1817
    1918from models import Animal, Stuff
    2019from models import Absolute, Parent, Child
  • tests/regressiontests/fixtures_regress/models.py

     
    1 from django.db import models, DEFAULT_DB_ALIAS, connection
     1from django.db import models
    22from django.contrib.auth.models import User
    3 from django.conf import settings
    43
    54
    65class Animal(models.Model):
  • tests/regressiontests/bash_completion/management/commands/test_command.py

     
    1 import sys, os
    2 from optparse import OptionParser, make_option
     1from optparse import make_option
    32
    43from django.core.management.base import BaseCommand
    54
  • tests/regressiontests/urlpatterns_reverse/tests.py

     
    33"""
    44from django.conf import settings
    55from django.core.exceptions import ImproperlyConfigured
    6 from django.core.urlresolvers import reverse, resolve, NoReverseMatch,\
    7                                      Resolver404, ResolverMatch,\
    8                                      RegexURLResolver, RegexURLPattern
     6from django.core.urlresolvers import (reverse, resolve, NoReverseMatch,
     7    Resolver404, ResolverMatch, RegexURLResolver, RegexURLPattern)
    98from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
    109from django.shortcuts import redirect
    1110from django.test import TestCase
  • tests/regressiontests/urlpatterns_reverse/middleware.py

     
    1 from django.core.urlresolvers import set_urlconf
    2 
    31import urlconf_inner
    42
    53class ChangeURLconfMiddleware(object):
Back to Top