Ticket #16225: 16225.3.diff
File 16225.3.diff, 137.5 KB (added by , 13 years ago) |
---|
-
django/test/client.py
5 5 import mimetypes 6 6 import warnings 7 7 from copy import copy 8 from urlparse import urlparse, url unparse, urlsplit8 from urlparse import urlparse, urlsplit 9 9 try: 10 10 from cStringIO import StringIO 11 11 except ImportError: … … 24 24 from django.utils.http import urlencode 25 25 from django.utils.importlib import import_module 26 26 from django.utils.itercompat import is_iterable 27 from django.db import transaction,close_connection27 from django.db import close_connection 28 28 from django.test.utils import ContextList 29 29 30 30 __all__ = ('Client', 'RequestFactory', 'encode_file', 'encode_multipart') -
django/test/testcases.py
6 6 from urlparse import urlsplit, urlunsplit 7 7 from xml.dom.minidom import parseString, Node 8 8 9 from django.conf import settings , UserSettingsHolder9 from django.conf import settings 10 10 from django.core import mail 11 11 from django.core.management import call_command 12 12 from django.core.signals import request_started -
django/test/utils.py
1 1 from __future__ import with_statement 2 2 3 import sys4 import time5 import os6 3 import warnings 7 4 from django.conf import settings, UserSettingsHolder 8 5 from django.core import mail 9 from django.core.mail.backends import locmem10 6 from django.test.signals import template_rendered, setting_changed 11 7 from django.template import Template, loader, TemplateDoesNotExist 12 8 from django.template.loaders import cached -
django/db/models/sql/compiler.py
5 5 from django.db.models.sql.constants import * 6 6 from django.db.models.sql.datastructures import EmptyResultSet 7 7 from 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 8 from django.db.models.sql.query import (get_proxied_model, get_order_dir, 9 select_related_descend, Query) 10 10 from django.db.utils import DatabaseError 11 11 12 12 class SQLCompiler(object): -
django/db/models/sql/where.py
6 6 7 7 from django.utils import tree 8 8 from django.db.models.fields import Field 9 from django.db.models.query_utils import QueryWrapper10 9 from datastructures import EmptyResultSet, FullResultSet 11 10 12 11 # Connection types -
django/db/models/sql/subqueries.py
3 3 """ 4 4 5 5 from django.core.exceptions import FieldError 6 from django.db import connections7 6 from django.db.models.fields import DateField, FieldDoesNotExist 8 7 from django.db.models.sql.constants import * 9 8 from django.db.models.sql.datastructures import Date 10 from django.db.models.sql.expressions import SQLEvaluator11 9 from django.db.models.sql.query import Query 12 10 from django.db.models.sql.where import AND, Constraint 13 11 -
django/db/models/base.py
1 1 import copy 2 2 import sys 3 import types4 3 from functools import update_wrapper 5 4 from itertools import izip 6 5 … … 8 7 from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS 9 8 from django.core import validators 10 9 from django.db.models.fields import AutoField, FieldDoesNotExist 11 from django.db.models.fields.related import (OneToOneRel, ManyToOneRel, 12 OneToOneField, add_lazy_relation) 10 from django.db.models.fields.related import ManyToOneRel, OneToOneField, add_lazy_relation 13 11 from django.db.models.query import Q 14 12 from django.db.models.query_utils import DeferredAttribute 15 13 from django.db.models.deletion import Collector -
django/db/models/manager.py
1 1 import copy 2 from django.conf import settings3 2 from django.db import router 4 3 from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet 5 4 from django.db.models import signals -
django/db/models/loading.py
6 6 from django.utils.importlib import import_module 7 7 from django.utils.module_loading import module_has_submodule 8 8 9 import imp10 9 import sys 11 10 import os 12 11 import threading -
django/db/models/fields/__init__.py
17 17 from django.utils.translation import ugettext_lazy as _ 18 18 from django.utils.encoding import smart_unicode, force_unicode, smart_str 19 19 from django.utils import datetime_safe 20 from django.utils.ipv6 import clean_ipv6_address , is_valid_ipv6_address20 from django.utils.ipv6 import clean_ipv6_address 21 21 22 22 class NOT_PROVIDED: 23 23 pass -
django/db/models/fields/related.py
1 from django.conf import settings 2 from django.db import connection, router, transaction 1 from django.db import connection, router 3 2 from django.db.backends import util 4 3 from django.db.models import signals, get_model 5 4 from django.db.models.fields import (AutoField, Field, IntegerField, … … 9 8 from django.db.models.query_utils import QueryWrapper 10 9 from django.db.models.deletion import CASCADE 11 10 from django.utils.encoding import smart_unicode 12 from django.utils.translation import (ugettext_lazy as _, string_concat, 13 ungettext, ugettext) 11 from django.utils.translation import ugettext_lazy as _, string_concat 14 12 from django.utils.functional import curry 15 13 from django.core import exceptions 16 14 from django import forms -
django/db/models/fields/files.py
1 1 import datetime 2 2 import os 3 3 4 from django .conf import settings4 from django import forms 5 5 from django.db.models.fields import Field 6 from django.core.files.base import File , ContentFile6 from django.core.files.base import File 7 7 from 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 8 from django.core.files.images import ImageFile 11 9 from django.db.models import signals 12 10 from django.utils.encoding import force_unicode, smart_str 13 from django.utils.translation import ugettext_lazy, ugettext as _ 14 from django import forms 15 from django.db.models.loading import cache 11 from django.utils.translation import ugettext_lazy as _ 16 12 17 13 class FieldFile(File): 18 14 def __init__(self, instance, field, name): … … 215 211 # The descriptor to use for accessing the attribute off of the class. 216 212 descriptor_class = FileDescriptor 217 213 218 description = ugettext_lazy("File path")214 description = _("File path") 219 215 220 216 def __init__(self, verbose_name=None, name=None, upload_to='', storage=None, **kwargs): 221 217 for arg in ('primary_key', 'unique'): … … 321 317 class ImageField(FileField): 322 318 attr_class = ImageFieldFile 323 319 descriptor_class = ImageFileDescriptor 324 description = ugettext_lazy("File path")320 description = _("File path") 325 321 326 322 def __init__(self, verbose_name=None, name=None, width_field=None, height_field=None, **kwargs): 327 323 self.width_field, self.height_field = width_field, height_field -
django/db/models/deletion.py
3 3 4 4 from django.db import connections, transaction, IntegrityError 5 5 from django.db.models import signals, sql 6 from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE7 6 from django.utils.datastructures import SortedDict 8 7 9 8 -
django/db/models/query.py
3 3 """ 4 4 5 5 import copy 6 from itertools import izip7 6 8 7 from django.db import connections, router, transaction, IntegrityError 9 from django.db.models.aggregates import Aggregate10 from django.db.models.fields import DateField11 8 from django.db.models.query_utils import (Q, select_related_descend, 12 9 deferred_class_factory, InvalidQuery) 13 10 from django.db.models.deletion import Collector 14 from django.db.models import s ignals, sql11 from django.db.models import sql 15 12 16 13 # Used to control how many objects are worked with at once in some cases (e.g. 17 14 # when deleting objects). -
django/db/models/query_utils.py
10 10 11 11 from django.db.backends import util 12 12 from django.utils import tree 13 from django.utils.datastructures import SortedDict14 13 15 14 16 15 class InvalidQuery(Exception): -
django/db/__init__.py
1 1 from django.conf import settings 2 2 from django.core import signals 3 3 from django.core.exceptions import ImproperlyConfigured 4 from django.db.utils import ConnectionHandler, ConnectionRouter, load_backend, DEFAULT_DB_ALIAS, \5 DatabaseError, IntegrityError4 from django.db.utils import (ConnectionHandler, ConnectionRouter, 5 load_backend, DEFAULT_DB_ALIAS, DatabaseError, IntegrityError) 6 6 7 7 __all__ = ('backend', 'connection', 'connections', 'router', 'DatabaseError', 8 8 'IntegrityError', 'DEFAULT_DB_ALIAS') -
django/db/backends/sqlite3/base.py
5 5 standard library. 6 6 """ 7 7 8 import datetime 9 import decimal 8 10 import re 9 11 import sys 10 import datetime11 12 12 13 from django.db import utils 13 14 from django.db.backends import * -
django/db/backends/mysql/base.py
4 4 Requires MySQLdb: http://sourceforge.net/projects/mysql-python 5 5 """ 6 6 7 import decimal 7 8 import re 8 9 import sys 9 10 -
django/db/backends/oracle/base.py
6 6 7 7 8 8 import datetime 9 from decimal import Decimal9 import decimal 10 10 import sys 11 11 12 12 … … 730 730 # This will normally be an integer from a sequence, 731 731 # but it could be a decimal value. 732 732 if '.' in value: 733 value = Decimal(value)733 value = decimal.Decimal(value) 734 734 else: 735 735 value = int(value) 736 736 else: … … 743 743 if scale == 0: 744 744 value = int(value) 745 745 else: 746 value = Decimal(value)746 value = decimal.Decimal(value) 747 747 elif '.' in value: 748 748 # No type information. This normally comes from a 749 749 # mathematical expression in the SELECT list. Guess int 750 750 # or Decimal based on whether it has a decimal point. 751 value = Decimal(value)751 value = decimal.Decimal(value) 752 752 else: 753 753 value = int(value) 754 754 elif desc[1] in (Database.STRING, Database.FIXED_CHAR, -
django/db/backends/oracle/creation.py
1 import sys, time 1 import sys 2 import time 2 3 from django.db.backends.creation import BaseDatabaseCreation 3 4 4 5 TEST_DATABASE_PREFIX = 'test_' -
django/db/backends/__init__.py
1 import decimal2 1 try: 3 2 import thread 4 3 except ImportError: -
django/db/backends/postgresql_psycopg2/base.py
3 3 4 4 Requires psycopg 2: http://initd.org/projects/psycopg2 5 5 """ 6 7 6 import sys 8 7 9 8 from django.db import utils -
django/db/backends/postgresql_psycopg2/operations.py
1 import re2 3 1 from django.db.backends import BaseDatabaseOperations 4 2 5 3 -
django/db/backends/dummy/base.py
7 7 ImproperlyConfigured. 8 8 """ 9 9 10 import decimal 11 10 12 from django.core.exceptions import ImproperlyConfigured 11 13 from django.db.backends import * 12 14 from django.db.backends.creation import BaseDatabaseCreation -
django/db/transaction.py
13 13 """ 14 14 from __future__ import with_statement 15 15 16 import sys17 16 from functools import wraps 18 17 19 from django.conf import settings20 18 from django.db import connections, DEFAULT_DB_ALIAS 21 19 22 20 -
django/forms/extras/widgets.py
2 2 Extra HTML Widget classes 3 3 """ 4 4 5 import time6 5 import datetime 7 6 import re 8 7 -
django/forms/models.py
8 8 from django.utils.text import get_text_list, capfirst 9 9 from django.utils.translation import ugettext_lazy as _, ugettext 10 10 11 from django.core.exceptions import ValidationError, NON_FIELD_ERRORS, \ 12 FieldError 11 from django.core.exceptions import ValidationError, NON_FIELD_ERRORS, FieldError 13 12 from django.core.validators import EMPTY_VALUES 14 13 from util import ErrorList 15 14 from forms import BaseForm, get_declared_fields -
django/core/mail/__init__.py
11 11 # django/core/mail.py before the introduction of email 12 12 # backends and the subsequent reorganization (See #10355) 13 13 from 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 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) 19 19 from django.core.mail.backends.smtp import EmailBackend as _SMTPConnection 20 20 21 21 def get_connection(backend=None, fail_silently=False, **kwds): -
django/core/servers/basehttp.py
18 18 from wsgiref.util import FileWrapper # for backwards compatibility 19 19 20 20 import django 21 from django.core.exceptions import ImproperlyConfigured22 21 from django.core.management.color import color_style 23 22 from django.utils._os import safe_join 24 23 from django.views import static -
django/core/servers/fastcgi.py
12 12 pass to this server. 13 13 """ 14 14 15 import os 16 import sys 15 17 from django.utils import importlib 16 import sys, os17 18 18 19 __version__ = "0.1" 19 20 __all__ = ["runfastcgi"] -
django/core/serializers/base.py
5 5 from StringIO import StringIO 6 6 7 7 from django.db import models 8 from django.utils.encoding import smart_str, smart_unicode 9 from django.utils import datetime_safe 8 from django.utils.encoding import smart_unicode 10 9 11 10 class SerializerDoesNotExist(KeyError): 12 11 """The requested serializer was not found.""" -
django/core/handlers/profiler-hotshot.py
1 import hotshot, time, os 1 import hotshot 2 import os 3 import time 4 2 5 from django.core.handlers.modpython import ModPythonHandler 3 6 4 7 PROFILE_DATA_DIR = "/var/log/cmsprofile" -
django/core/handlers/wsgi.py
1 from pprint import pformat2 1 import sys 3 2 from threading import Lock 4 3 try: 5 4 from cStringIO import StringIO 6 5 except ImportError: 7 6 from StringIO import StringIO 8 import socket9 7 10 8 from django import http 11 9 from django.core import signals -
django/core/handlers/modpython.py
1 1 import os 2 from pprint import pformat3 2 import sys 4 3 from warnings import warn 5 4 … … 8 7 from django.core.handlers.base import BaseHandler 9 8 from django.core.urlresolvers import set_script_prefix 10 9 from django.utils import datastructures 11 from django.utils.encoding import force_unicode, smart_str,iri_to_uri10 from django.utils.encoding import force_unicode, iri_to_uri 12 11 from django.utils.log import getLogger 13 12 14 13 logger = getLogger('django.request') -
django/core/cache/backends/base.py
2 2 3 3 import warnings 4 4 5 from django.conf import settings6 5 from django.core.exceptions import ImproperlyConfigured, DjangoRuntimeWarning 7 6 from django.utils.encoding import smart_str 8 7 from django.utils.importlib import import_module -
django/core/cache/backends/db.py
2 2 3 3 from django.core.cache.backends.base import BaseCache 4 4 from django.db import connections, router, transaction, DatabaseError 5 import base64 , time5 import base64 6 6 from datetime import datetime 7 7 try: 8 8 import cPickle as pickle 9 9 except ImportError: 10 10 import pickle 11 import time 11 12 12 13 class Options(object): 13 14 """A class that will quack like a Django model _meta class. -
django/core/cache/backends/memcached.py
4 4 from threading import local 5 5 6 6 from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError 7 from django.utils import importlib8 7 9 8 class BaseMemcachedCache(BaseCache): 10 9 def __init__(self, server, params, library, value_not_found_exception): -
django/core/management/commands/reset.py
1 1 from optparse import make_option 2 2 3 from django.conf import settings4 3 from django.core.management.base import AppCommand, CommandError 5 4 from django.core.management.color import no_style 6 5 from 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 1 from django.template import Library, TemplateSyntaxError 2 from django.template.defaulttags import kwarg_re, SsiNode, URLNode 5 3 6 4 7 5 register = Library() -
django/templatetags/l10n.py
1 from django.conf import settings2 1 from django.template import Node 3 2 from django.template import TemplateSyntaxError, Library 4 3 from django.utils import formats -
django/templatetags/cache.py
2 2 from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist 3 3 from django.template import resolve_variable 4 4 from django.core.cache import cache 5 from django.utils.encoding import force_unicode6 5 from django.utils.http import urlquote 7 6 8 7 register = Library() -
django/views/decorators/http.py
3 3 """ 4 4 5 5 from calendar import timegm 6 from datetime import timedelta7 6 from functools import wraps 8 7 9 8 from django.utils.decorators import decorator_from_middleware, available_attrs -
django/views/generic/base.py
1 1 from functools import update_wrapper 2 2 from django import http 3 3 from django.core.exceptions import ImproperlyConfigured 4 from django.template import RequestContext, loader5 4 from django.template.response import TemplateResponse 6 5 from django.utils.log import getLogger 7 6 from django.utils.decorators import classonlymethod -
django/views/generic/list.py
1 import re2 3 1 from django.core.paginator import Paginator, InvalidPage 4 2 from django.core.exceptions import ImproperlyConfigured 5 3 from django.http import Http404 -
django/views/generic/detail.py
1 import re2 3 1 from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist 4 2 from django.http import Http404 5 3 from django.utils.encoding import smart_str -
django/views/debug.py
3 3 import re 4 4 import sys 5 5 import types 6 from pprint import pformat7 6 8 7 from django.conf import settings 9 8 from django.http import (HttpResponse, HttpResponseServerError, -
django/dispatch/saferef.py
5 5 aren't handled by the core weakref module). 6 6 """ 7 7 8 import weakref, traceback 8 import traceback 9 import weakref 9 10 10 11 def safeRef(target, onDelete = None): 11 12 """Return a *safe* weak reference to a callable target -
django/utils/translation/trans_real.py
4 4 import os 5 5 import re 6 6 import sys 7 import warnings8 7 import gettext as gettext_module 9 from cStringIO import StringIO10 8 from threading import local 11 9 10 try: 11 from cStringIO import StringIO 12 except ImportError: 13 from StringIO import StringIO 14 12 15 from django.utils.importlib import import_module 13 16 from django.utils.safestring import mark_safe, SafeData 14 17 -
django/utils/translation/trans_null.py
2 2 # that don't actually do anything. This is purely for performance, so that 3 3 # settings.USE_I18N = False can use this module rather than trans_real.py. 4 4 5 import warnings6 5 from django.conf import settings 7 6 from django.utils.encoding import force_unicode 8 7 from django.utils.safestring import mark_safe, SafeData -
django/utils/cache.py
26 26 from django.utils.encoding import smart_str, iri_to_uri 27 27 from django.utils.http import http_date 28 28 from django.utils.translation import get_language 29 from django.http import HttpRequest30 29 31 30 cc_delim_re = re.compile(r'\s*,\s*') 32 31 -
django/utils/timesince.py
1 1 import datetime 2 import time3 2 4 3 from django.utils.tzinfo import LocalTimezone 5 4 from django.utils.translation import ungettext, ugettext -
django/utils/log.py
1 1 import logging 2 import sys3 2 import traceback 4 3 5 4 from django.conf import settings -
django/utils/text.py
1 1 import re 2 from gzip import GzipFile 3 from htmlentitydefs import name2codepoint 4 5 try: 6 from cStringIO import StringIO 7 except ImportError: 8 from StringIO import StringIO 9 2 10 from django.utils.encoding import force_unicode 3 11 from django.utils.functional import allow_lazy 4 12 from django.utils.translation import ugettext_lazy, ugettext as _ 5 from htmlentitydefs import name2codepoint6 13 14 7 15 # Capitalizes the first letter of a string. 8 16 capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:] 9 17 capfirst = allow_lazy(capfirst, unicode) … … 180 188 # From http://www.xhaus.com/alan/python/httpcomp.html#gzip 181 189 # Used with permission. 182 190 def compress_string(s): 183 import cStringIO, gzip 184 zbuf = cStringIO.StringIO() 185 zfile = gzip.GzipFile(mode='wb', compresslevel=6, fileobj=zbuf) 191 zbuf = StringIO() 192 zfile = GzipFile(mode='wb', compresslevel=6, fileobj=zbuf) 186 193 zfile.write(s) 187 194 zfile.close() 188 195 return zbuf.getvalue() -
django/utils/version.py
1 1 import django 2 import os.path3 2 import re 4 3 5 4 def get_svn_revision(path=None): -
django/contrib/gis/db/models/sql/aggregates.py
1 1 from django.db.models.sql.aggregates import * 2 2 from django.contrib.gis.db.models.fields import GeometryField 3 from django.contrib.gis.db.models.sql.conversion import GeomField4 3 5 4 class GeoAggregate(Aggregate): 6 5 # Default SQL template for spatial aggregates. -
django/contrib/gis/db/models/sql/where.py
1 from django.db.models.fields import Field , FieldDoesNotExist1 from django.db.models.fields import FieldDoesNotExist 2 2 from django.db.models.sql.constants import LOOKUP_SEP 3 3 from django.db.models.sql.expressions import SQLEvaluator 4 4 from django.db.models.sql.where import Constraint, WhereNode -
django/contrib/gis/db/models/__init__.py
8 8 from django.contrib.gis.db.models.manager import GeoManager 9 9 10 10 # The geographic-enabled fields. 11 from django.contrib.gis.db.models.fields import \12 GeometryField, PointField, LineStringField, PolygonField, \13 MultiPointField, MultiLineStringField, MultiPolygonField, \14 GeometryCollectionField 11 from 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
1 1 from django.db import connections 2 from django.db.models.query import QuerySet, Q,ValuesQuerySet, ValuesListQuerySet2 from django.db.models.query import QuerySet, ValuesQuerySet, ValuesListQuerySet 3 3 4 4 from django.contrib.gis.db.models import aggregates 5 from django.contrib.gis.db.models.fields import get_srid_info, GeometryField,PointField, LineStringField6 from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery , GeoWhereNode5 from django.contrib.gis.db.models.fields import get_srid_info, PointField, LineStringField 6 from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery 7 7 from django.contrib.gis.geometry.backend import Geometry 8 8 from django.contrib.gis.measure import Area, Distance 9 9 -
django/contrib/gis/db/backends/spatialite/base.py
3 3 4 4 from django.core.exceptions import ImproperlyConfigured 5 5 from django.db.backends.sqlite3.base import * 6 from django.db.backends.sqlite3.base import DatabaseWrapper as SqliteDatabaseWrapper , \7 6 from django.db.backends.sqlite3.base import DatabaseWrapper as SqliteDatabaseWrapper 7 from django.db.backends.sqlite3.base import _sqlite_extract, _sqlite_date_trunc, _sqlite_regexp 8 8 from django.contrib.gis.db.backends.spatialite.client import SpatiaLiteClient 9 9 from django.contrib.gis.db.backends.spatialite.creation import SpatiaLiteCreation 10 10 from django.contrib.gis.db.backends.spatialite.introspection import SpatiaLiteIntrospection -
django/contrib/gis/db/backends/base.py
3 3 `SpatialRefSys` model the backend. 4 4 """ 5 5 import re 6 from django.conf import settings7 6 from django.contrib.gis import gdal 8 7 9 8 class BaseSpatialOperations(object): -
django/contrib/gis/db/backends/oracle/models.py
8 8 model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model. 9 9 """ 10 10 from django.contrib.gis.db import models 11 from django.contrib.gis.db.models.fields import GeometryField12 11 from django.contrib.gis.db.backends.base import SpatialRefSysMixin 13 12 14 13 class GeometryColumns(models.Model): -
django/contrib/gis/shortcuts.py
1 import cStringIO, zipfile 1 try: 2 from cStringIO import StringIO 3 except ImportError: 4 from StringIO import StringIO 5 import zipfile 2 6 from django.conf import settings 3 7 from django.http import HttpResponse 4 8 from django.template import loader 5 9 6 10 def compress_kml(kml): 7 11 "Returns compressed KMZ from the given KML string." 8 kmz = cStringIO.StringIO()12 kmz = StringIO() 9 13 zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED) 10 14 zf.writestr('doc.kml', kml.encode(settings.DEFAULT_CHARSET)) 11 15 zf.close() -
django/contrib/gis/admin/options.py
1 from django.conf import settings2 1 from django.contrib.admin import ModelAdmin 3 2 from django.contrib.gis.admin.widgets import OpenLayersWidget 4 3 from django.contrib.gis.gdal import OGRGeomType -
django/contrib/gis/admin/widgets.py
1 from django.conf import settings2 1 from django.forms.widgets import Textarea 3 2 from django.template import loader, Context 4 3 from django.templatetags.static import static -
django/contrib/gis/geometry/backend/geos.py
1 from django.contrib.gis.geos import \ 2 GEOSGeometry as Geometry, \ 3 GEOSException as GeometryException 1 from django.contrib.gis.geos import ( 2 GEOSGeometry as Geometry, GEOSException as GeometryException) -
django/contrib/gis/geos/geometry.py
3 3 inherit from this object. 4 4 """ 5 5 # Python, ctypes and types dependencies. 6 import re7 6 import warnings 8 from ctypes import addressof, byref, c_double , c_size_t7 from ctypes import addressof, byref, c_double 9 8 10 9 # super-class for mutable list behavior 11 10 from django.contrib.gis.geos.mutable_list import ListMixin -
django/contrib/gis/geos/prototypes/topology.py
7 7 'geos_linemerge', 'geos_pointonsurface', 'geos_preservesimplify', 8 8 'geos_simplify', 'geos_symdifference', 'geos_union', 'geos_relate'] 9 9 10 from ctypes import c_ char_p, c_double, c_int10 from ctypes import c_double, c_int 11 11 from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE 12 12 from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string 13 13 from django.contrib.gis.geos.prototypes.geom import geos_char_p -
django/contrib/gis/geos/prototypes/__init__.py
5 5 """ 6 6 7 7 # 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 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) 11 11 12 12 # 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 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) 19 19 20 20 # Miscellaneous routines. 21 21 from django.contrib.gis.geos.prototypes.misc import * 22 22 23 23 # 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 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) 28 28 29 29 # Topology routines 30 30 from 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,POINTER2 from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR , PREPGEOM_PTR, GEOS_PREPARE3 from django.contrib.gis.geos.prototypes.errcheck import \4 check_geom, check_minus_one, check_sized_string, check_string, check_zero 1 from ctypes import c_char_p, c_int, c_size_t, c_ubyte, POINTER 2 from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR 3 from django.contrib.gis.geos.prototypes.errcheck import ( 4 check_geom, check_minus_one, check_sized_string, check_string, check_zero) 5 5 from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc 6 6 7 7 # This is the return type used by binary output (WKB, HEX) routines. -
django/contrib/gis/geos/base.py
1 1 from ctypes import c_void_p 2 2 from types import NoneType 3 from django.contrib.gis.geos.error import GEOSException , GEOSIndexError3 from django.contrib.gis.geos.error import GEOSException 4 4 5 5 # Trying to import GDAL libraries, if available. Have to place in 6 6 # try/except since this package may be used outside GeoDjango. -
django/contrib/gis/geos/tests/test_geos.py
1 import ctypes, random, unittest, sys 1 import ctypes 2 import random 3 import unittest 2 4 from django.contrib.gis.geos import * 3 5 from django.contrib.gis.geos.base import gdal, numpy, GEOSBase 4 6 from django.contrib.gis.geos.libgeos import GEOS_PREPARE -
django/contrib/gis/geos/tests/test_geos_mutation.py
2 2 # Modified from original contribution by Aryeh Leib Taurog, which was 3 3 # released under the New BSD license. 4 4 5 import copy6 5 from django.contrib.gis.geos import * 7 6 from django.contrib.gis.geos.error import GEOSIndexError 8 7 from django.utils import unittest -
django/contrib/gis/geos/tests/test_io.py
1 import binascii, ctypes, unittest 1 import binascii 2 import unittest 2 3 from django.contrib.gis.geos import GEOSGeometry, WKTReader, WKTWriter, WKBReader, WKBWriter, geos_version_info 3 4 4 5 class GEOSIOTest(unittest.TestCase): -
django/contrib/gis/geos/collections.py
3 3 GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon 4 4 """ 5 5 from ctypes import c_int, c_uint, byref 6 from django.contrib.gis.geos.error import GEOSException , GEOSIndexError6 from django.contrib.gis.geos.error import GEOSException 7 7 from django.contrib.gis.geos.geometry import GEOSGeometry 8 from django.contrib.gis.geos.libgeos import get_pointer_arr, GEO M_PTR, GEOS_PREPARE8 from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOS_PREPARE 9 9 from django.contrib.gis.geos.linestring import LineString, LinearRing 10 10 from django.contrib.gis.geos.point import Point 11 11 from django.contrib.gis.geos.polygon import Polygon -
django/contrib/gis/geos/libgeos.py
6 6 This module also houses GEOS Pointer utilities, including 7 7 get_pointer_arr(), and GEOM_PTR. 8 8 """ 9 import os, re, sys 9 import os 10 import re 11 import sys 10 12 from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER 11 13 from ctypes.util import find_library 12 14 from django.contrib.gis.geos.error import GEOSException -
django/contrib/gis/geos/polygon.py
1 1 from ctypes import c_uint, byref 2 from django.contrib.gis.geos.error import GEOSIndexError3 2 from django.contrib.gis.geos.geometry import GEOSGeometry 4 3 from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR 5 4 from django.contrib.gis.geos.linestring import LinearRing -
django/contrib/gis/maps/google/gmap.py
1 1 from django.conf import settings 2 from django.contrib.gis import geos3 2 from django.template.loader import render_to_string 4 3 from django.utils.safestring import mark_safe 5 4 6 class GoogleMapException(Exception): pass7 from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker, GIcon 5 class GoogleMapException(Exception): 6 pass 8 7 8 from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker 9 9 10 # The default Google Maps URL (for the API javascript) 10 11 # TODO: Internationalize for Japan, UK, etc. 11 12 GOOGLE_MAPS_URL='http://maps.google.com/maps?file=api&v=%s&key=' -
django/contrib/gis/maps/google/zoom.py
1 1 from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point 2 2 from django.contrib.gis.maps.google.gmap import GoogleMapException 3 from math import pi, sin, cos,log, exp, atan3 from math import pi, sin, log, exp, atan 4 4 5 5 # Constants used for degree to radian conversion, and vice-versa. 6 6 DTOR = pi / 180. -
django/contrib/gis/utils/layermapping.py
7 7 http://geodjango.org/docs/layermapping.html 8 8 """ 9 9 import sys 10 from datetime import date, datetime11 10 from decimal import Decimal 12 11 from django.core.exceptions import ObjectDoesNotExist 13 12 from django.db import connections, DEFAULT_DB_ALIAS 14 13 from 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 14 from django.contrib.gis.gdal import (CoordTransform, DataSource, 15 OGRException, OGRGeometry, OGRGeomType, SpatialReference) 16 from django.contrib.gis.gdal.field import ( 17 OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime) 19 18 from django.db import models, transaction 20 19 from django.contrib.localflavor.us.models import USStateField 21 20 -
django/contrib/gis/utils/ogrinspect.py
8 8 from itertools import izip 9 9 # Requires GDAL to use. 10 10 from django.contrib.gis.gdal import DataSource 11 from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString , OFTTime11 from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString 12 12 13 13 def mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False): 14 14 """ -
django/contrib/gis/utils/geoip.py
38 38 >>> g.geos('24.124.1.80').wkt 39 39 'POINT (-95.2087020874023438 39.0392990112304688)' 40 40 """ 41 import os, re 41 import os 42 import re 42 43 from ctypes import c_char_p, c_float, c_int, Structure, CDLL, POINTER 43 44 from ctypes.util import find_library 44 45 from django.conf import settings -
django/contrib/gis/tests/test_spatialrefsys.py
1 1 from django.db import connection 2 2 from django.contrib.gis.gdal import GDAL_VERSION 3 from django.contrib.gis.tests.utils import mysql,no_mysql, oracle, postgis, spatialite3 from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite 4 4 from django.utils import unittest 5 5 6 6 -
django/contrib/gis/tests/geo3d/tests.py
5 5 from django.contrib.gis.geos import GEOSGeometry, Point, Polygon 6 6 from django.contrib.gis.utils import LayerMapping, LayerMapError 7 7 8 from models import City3D, Interstate2D, Interstate3D, \9 InterstateProj2D, InterstateProj3D, \10 Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D 8 from models import (City3D, Interstate2D, Interstate3D, 9 InterstateProj2D, InterstateProj3D, 10 Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D) 11 11 12 12 data_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'data')) 13 13 city_file = os.path.join(data_path, 'cities', 'cities.shp') -
django/contrib/gis/tests/geogapp/tests.py
79 79 80 80 def test06_geography_area(self): 81 81 "Testing that Area calculations work on geography columns." 82 from django.contrib.gis.measure import A83 82 # SELECT ST_Area(poly) FROM geogapp_zipcode WHERE code='77002'; 84 83 ref_area = 5439084.70637573 85 84 tol = 5 -
django/contrib/gis/tests/distapp/tests.py
1 import os2 from decimal import Decimal3 4 1 from django.db import connection 5 2 from django.db.models import Q 6 from django.contrib.gis.geos import GEOSGeometry, Point,LineString3 from django.contrib.gis.geos import GEOSGeometry, LineString 7 4 from django.contrib.gis.measure import D # alias for Distance 8 5 from django.contrib.gis.tests.utils import oracle, postgis, spatialite, no_oracle, no_spatialite 9 6 from django.test import TestCase 10 7 11 from models import AustraliaCity, Interstate, SouthTexasInterstate, \12 SouthTexasCity, SouthTexasCityFt, CensusZipcode, SouthTexasZipcode 8 from models import (AustraliaCity, Interstate, SouthTexasInterstate, 9 SouthTexasCity, SouthTexasCityFt, CensusZipcode, SouthTexasZipcode) 13 10 14 11 class DistanceTest(TestCase): 15 12 -
django/contrib/gis/tests/test_geoip.py
1 import os, unittest 1 import os 2 import unittest 2 3 from django.db import settings 3 4 from django.contrib.gis.geos import GEOSGeometry 4 5 from django.contrib.gis.utils import GeoIP, GeoIPException -
django/contrib/gis/tests/layermap/tests.py
4 4 5 5 from django.utils.unittest import TestCase 6 6 7 from django.contrib.gis.gdal import DataSource , OGRException7 from django.contrib.gis.gdal import DataSource 8 8 from django.contrib.gis.tests.utils import mysql 9 9 from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, MissingForeignKey 10 10 11 from models import \12 City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State, \13 city_mapping, co_mapping, cofeat_mapping, inter_mapping 11 from models import ( 12 City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State, 13 city_mapping, co_mapping, cofeat_mapping, inter_mapping) 14 14 15 15 shp_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, 'data')) 16 16 city_shp = os.path.join(shp_path, 'cities', 'cities.shp') -
django/contrib/gis/tests/geoapp/test_regress.py
1 import os,unittest2 from django.contrib.gis.tests.utils import no_mysql, no_ oracle, no_postgis, no_spatialite1 import unittest 2 from django.contrib.gis.tests.utils import no_mysql, no_spatialite 3 3 from django.contrib.gis.shortcuts import render_to_kmz 4 4 from models import City 5 5 -
django/contrib/gis/tests/geoapp/tests.py
1 1 import re 2 2 from django.db import connection 3 3 from 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 4 from django.contrib.gis.geos import (fromstr, GEOSGeometry, 5 Point, LineString, LinearRing, Polygon, GeometryCollection) 6 from django.contrib.gis.tests.utils import ( 7 no_mysql, no_oracle, no_spatialite, 8 mysql, oracle, postgis, spatialite) 10 9 from django.test import TestCase 11 10 12 11 from models import Country, City, PennsylvaniaCity, State, Track -
django/contrib/gis/tests/geoapp/test_sitemaps.py
1 import cStringIO 1 try: 2 from cStringIO import StringIO 3 except ImportError: 4 from StringIO import StringIO 2 5 from xml.dom import minidom 3 6 import zipfile 4 7 from django.conf import settings … … 60 63 kml_doc = minidom.parseString(self.client.get(kml_url).content) 61 64 elif kml_type == 'kmz': 62 65 # 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) 64 67 zf = zipfile.ZipFile(buf) 65 68 self.assertEqual(1, len(zf.filelist)) 66 69 self.assertEqual('doc.kml', zf.filelist[0].filename) -
django/contrib/gis/tests/geoapp/feeds.py
1 1 from django.contrib.gis import feeds 2 from django.contrib.gis.tests.utils import mysql 3 from models import City, Country 2 from models import City 4 3 5 4 class TestGeoRSS1(feeds.Feed): 6 5 link = '/city/' -
django/contrib/gis/gdal/datasource.py
34 34 val = field.value 35 35 """ 36 36 # ctypes prerequisites. 37 from ctypes import byref , c_void_p37 from ctypes import byref 38 38 39 39 # The GDAL C library, OGR exceptions, and the Layer object. 40 40 from django.contrib.gis.gdal.base import GDALBase -
django/contrib/gis/gdal/feature.py
3 3 from django.contrib.gis.gdal.error import OGRException, OGRIndexError 4 4 from django.contrib.gis.gdal.field import Field 5 5 from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType 6 from django.contrib.gis.gdal.srs import SpatialReference7 6 8 7 # ctypes function prototypes 9 8 from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api -
django/contrib/gis/gdal/libgdal.py
1 import os, re, sys 1 import os 2 import re 2 3 from ctypes import c_char_p, CDLL 3 4 from ctypes.util import find_library 4 5 from django.contrib.gis.gdal.error import OGRException -
django/contrib/gis/gdal/prototypes/generation.py
4 4 """ 5 5 6 6 from 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 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) 10 10 11 11 class gdal_char_p(c_char_p): 12 12 pass -
django/contrib/gis/gdal/prototypes/ds.py
6 6 from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER 7 7 from django.contrib.gis.gdal.envelope import OGREnvelope 8 8 from 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 9 from django.contrib.gis.gdal.prototypes.generation import (const_string_output, 10 double_output, geom_output, int_output, srs_output, void_output, voidptr_output) 12 11 13 12 c_int_p = POINTER(c_int) # shortcut type 14 13 -
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 1 from ctypes import c_char_p, c_double, c_int, c_void_p, POINTER 4 2 from django.contrib.gis.gdal.envelope import OGREnvelope 5 3 from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON 6 4 from 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 5 from django.contrib.gis.gdal.prototypes.generation import (const_string_output, 6 double_output, geom_output, int_output, srs_output, string_output, void_output) 10 7 11 8 ### Generation routines specific to this module ### 12 9 def env_func(f, argtypes): -
django/contrib/gis/gdal/prototypes/srs.py
1 1 from ctypes import c_char_p, c_int, c_void_p, POINTER 2 2 from 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 3 from django.contrib.gis.gdal.prototypes.generation import (const_string_output, 4 double_output, int_output, srs_output, string_output, void_output) 6 5 7 6 ## Shortcut generation for routines with known parameters. 8 7 def srs_double(f): -
django/contrib/gis/gdal/srs.py
26 26 >>> print srs.name 27 27 NAD83 / Texas South Central 28 28 """ 29 import re 30 from ctypes import byref, c_char_p, c_int, c_void_p 29 from ctypes import byref, c_char_p, c_int 31 30 32 31 # Getting the error checking routine and exceptions 33 32 from django.contrib.gis.gdal.base import GDALBase 34 from django.contrib.gis.gdal.error import OGRException,SRSException33 from django.contrib.gis.gdal.error import SRSException 35 34 from django.contrib.gis.gdal.prototypes import srs as capi 36 35 37 36 #### Spatial Reference class. #### -
django/contrib/gis/gdal/tests/test_driver.py
1 import os, os.path,unittest1 import unittest 2 2 from django.contrib.gis.gdal import Driver, OGRException 3 3 4 4 valid_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 1 from binascii import b2a_hex 2 try: 3 import cPickle as pickle 4 except ImportError: 5 import pickle 6 7 from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType, OGRException, 8 OGRIndexError, SpatialReference, CoordTransform, GDAL_VERSION) 9 from django.contrib.gis.gdal.prototypes.geom import GEOJSON 10 from django.contrib.gis.geometry.test_data import TestDataMixin 4 11 from django.utils import unittest 5 from django.contrib.gis.geometry.test_data import TestDataMixin6 12 7 13 class OGRGeomTest(unittest.TestCase, TestDataMixin): 8 14 "This tests the OGR Geometry." … … 92 98 93 99 def test01d_wkb(self): 94 100 "Testing WKB input/output." 95 from binascii import b2a_hex96 101 for g in self.geometries.hex_wkt: 97 102 geom1 = OGRGeometry(g.wkt) 98 103 wkb = geom1.wkb … … 103 108 104 109 def test01e_json(self): 105 110 "Testing GeoJSON input/output." 106 from django.contrib.gis.gdal.prototypes.geom import GEOJSON107 111 if not GEOJSON: return 108 112 for g in self.geometries.json_geoms: 109 113 geom = OGRGeometry(g.wkt) … … 446 450 447 451 def test17_pickle(self): 448 452 "Testing pickle support." 449 import cPickle450 453 g1 = OGRGeometry('LINESTRING(1 1 1,2 2 2,3 3 3)', 'WGS84') 451 g2 = cPickle.loads(cPickle.dumps(g1))454 g2 = pickle.loads(pickle.dumps(g1)) 452 455 self.assertEqual(g1, g2) 453 456 self.assertEqual(4326, g2.srs.srid) 454 457 self.assertEqual(g1.srs.wkt, g2.srs.wkt) -
django/contrib/gis/management/commands/inspectdb.py
1 from optparse import make_option2 3 from django.core.management.base import CommandError4 1 from django.core.management.commands.inspectdb import Command as InspectDBCommand 5 2 6 3 class Command(InspectDBCommand): -
django/contrib/gis/management/commands/ogrinspect.py
1 import os , sys1 import os 2 2 from optparse import make_option 3 3 from django.contrib.gis import gdal 4 4 from django.contrib.gis.management.base import ArgsCommand, CommandError -
django/contrib/gis/feeds.py
1 from django.contrib.syndication.feeds import Feed as BaseFeed , FeedDoesNotExist1 from django.contrib.syndication.feeds import Feed as BaseFeed 2 2 from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed 3 3 4 4 class GeoFeedMixin(object): -
django/contrib/formtools/wizard/tests/namedwizardtests/tests.py
1 import os2 3 1 from django.core.urlresolvers import reverse 4 2 from django.http import QueryDict 5 3 from django.test import TestCase 6 from django.conf import settings7 4 8 5 from django.contrib.auth.models import User 9 6 -
django/contrib/formtools/wizard/storage/session.py
1 from django.core.files.uploadedfile import UploadedFile2 1 from django.contrib.formtools.wizard import storage 3 2 4 3 -
django/contrib/formtools/wizard/views.py
1 import copy2 1 import re 3 2 4 3 from django import forms -
django/contrib/formtools/utils.py
5 5 6 6 import hashlib 7 7 from django.conf import settings 8 from django.forms import BooleanField9 8 from django.utils.crypto import salted_hmac 10 9 11 10 -
django/contrib/formtools/preview.py
2 2 Formtools Preview application. 3 3 """ 4 4 5 try:6 import cPickle as pickle7 except ImportError:8 import pickle9 10 from django.conf import settings11 5 from django.http import Http404 12 6 from django.shortcuts import render_to_response 13 7 from django.template.context import RequestContext -
django/contrib/sitemaps/views.py
1 1 from django.core import urlresolvers 2 2 from django.core.paginator import EmptyPage, PageNotAnInteger 3 from django.http import Http Response, Http4043 from django.http import Http404 4 4 from django.template.response import TemplateResponse 5 from django.utils.encoding import smart_str6 5 7 6 from django.contrib.sites.models import get_current_site 8 7 -
django/contrib/sitemaps/__init__.py
1 from django.contrib.sites.models import Site , get_current_site1 from django.contrib.sites.models import Site 2 2 from django.core import urlresolvers, paginator 3 3 from django.core.exceptions import ImproperlyConfigured 4 4 import urllib -
django/contrib/admin/templatetags/admin_list.py
1 1 import datetime 2 2 3 from django.conf import settings4 3 from django.contrib.admin.util import lookup_field, display_for_field, label_for_field 5 4 from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE, 6 ORDER_VAR, ORDER_TYPE_VAR,PAGE_VAR, SEARCH_VAR)5 ORDER_VAR, PAGE_VAR, SEARCH_VAR) 7 6 from django.core.exceptions import ObjectDoesNotExist 8 7 from django.db import models 9 8 from django.templatetags.static import static 10 9 from django.utils import formats 11 from django.utils.datastructures import SortedDict12 10 from django.utils.html import escape, conditional_escape 13 11 from django.utils.safestring import mark_safe 14 12 from django.utils.text import capfirst -
django/contrib/admin/views/main.py
19 19 # Changelist settings 20 20 ALL_VAR = 'all' 21 21 ORDER_VAR = 'o' 22 ORDER_TYPE_VAR = 'ot'23 22 PAGE_VAR = 'p' 24 23 SEARCH_VAR = 'q' 25 24 TO_FIELD_VAR = 't' 26 25 IS_POPUP_VAR = 'pop' 27 26 ERROR_FLAG = 'e' 28 27 29 IGNORED_PARAMS = ( 30 ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR, TO_FIELD_VAR) 28 IGNORED_PARAMS = (ALL_VAR, ORDER_VAR, SEARCH_VAR, IS_POPUP_VAR, TO_FIELD_VAR) 31 29 32 30 # Text to display within change-list table cells if the value is blank. 33 31 EMPTY_CHANGELIST_VALUE = ugettext_lazy('(None)') -
django/contrib/admin/widgets.py
4 4 5 5 import copy 6 6 from django import forms 7 from django.conf import settings8 7 from django.core.urlresolvers import reverse, NoReverseMatch 9 8 from django.forms.widgets import RadioFieldRenderer 10 9 from django.forms.util import flatatt -
django/contrib/admindocs/views.py
1 from django import template, templatetags 1 import inspect 2 import os 3 import re 4 5 from django import template 2 6 from django.template import RequestContext 3 7 from django.conf import settings 4 8 from django.contrib.admin.views.decorators import staff_member_required … … 12 16 from django.utils.importlib import import_module 13 17 from django.utils.translation import ugettext as _ 14 18 from django.utils.safestring import mark_safe 15 import inspect, os, re16 19 17 20 # Exclude methods starting with these strings from documentation 18 21 MODEL_METHODS_EXCLUDE = ('_', 'add_', 'delete', 'save', 'set_') -
django/contrib/auth/__init__.py
1 import datetime2 1 from warnings import warn 3 2 from django.core.exceptions import ImproperlyConfigured 4 3 from django.utils.importlib import import_module -
django/contrib/auth/backends.py
1 from django.db import connection2 1 from django.contrib.auth.models import User, Permission 3 2 4 3 -
django/contrib/auth/tests/auth_backends.py
1 import warnings2 3 1 from django.conf import settings 4 2 from django.contrib.auth.models import User, Group, Permission, AnonymousUser 5 3 from django.contrib.contenttypes.models import ContentType -
django/contrib/auth/tests/tokens.py
1 1 from datetime import date, timedelta 2 2 3 3 from django.conf import settings 4 from django.contrib.auth.models import User , AnonymousUser4 from django.contrib.auth.models import User 5 5 from django.contrib.auth.tokens import PasswordResetTokenGenerator 6 6 from django.test import TestCase 7 7 -
django/contrib/auth/tests/forms.py
1 1 from __future__ import with_statement 2 2 import os 3 from django.conf import settings4 3 from django.core import mail 5 4 from django.contrib.auth.models import User 6 5 from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm -
django/contrib/auth/models.py
10 10 11 11 from django.contrib import auth 12 12 from django.contrib.auth.signals import user_logged_in 13 # UNUSABLE_PASSWORD is still imported here for backwards compatibility 13 14 from django.contrib.auth.utils import (get_hexdigest, make_password, 14 check_password, is_password_usable,15 get_random_string,UNUSABLE_PASSWORD)15 check_password, is_password_usable, get_random_string, 16 UNUSABLE_PASSWORD) 16 17 from django.contrib.contenttypes.models import ContentType 17 18 18 19 def update_last_login(sender, user, **kwargs): -
django/contrib/auth/management/__init__.py
102 102 :returns: The username, or an empty string if no username can be 103 103 determined. 104 104 """ 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) 107 107 default_username = get_system_username() 108 108 try: 109 109 default_username = unicodedata.normalize('NFKD', default_username)\ -
django/contrib/auth/forms.py
1 1 from django import forms 2 from django.template import Context,loader2 from django.template import loader 3 3 from django.utils.http import int_to_base36 4 4 from django.utils.itercompat import any 5 5 from django.utils.translation import ugettext_lazy as _ 6 6 7 from django.contrib.auth.models import User, UNUSABLE_PASSWORD 7 from django.contrib.auth.models import User 8 from django.contrib.auth.utils import UNUSABLE_PASSWORD 8 9 from django.contrib.auth import authenticate 9 10 from django.contrib.auth.tokens import default_token_generator 10 11 from django.contrib.sites.models import get_current_site -
django/contrib/localflavor/kw/forms.py
6 6 7 7 from django.core.validators import EMPTY_VALUES 8 8 from django.forms import ValidationError 9 from django.forms.fields import Field , RegexField9 from django.forms.fields import Field 10 10 from django.utils.translation import gettext as _ 11 11 12 12 id_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
1 1 """ 2 2 Belgium-specific Form helpers 3 3 """ 4 import re5 6 from django.core.validators import EMPTY_VALUES7 from django.forms import ValidationError8 4 from django.forms.fields import RegexField, Select 9 5 from django.utils.translation import ugettext_lazy as _ 10 6 -
django/contrib/localflavor/us/models.py
1 from django.conf import settings2 1 from django.utils.translation import ugettext_lazy as _ 3 2 from django.db.models.fields import CharField 4 3 from django.contrib.localflavor.us.us_states import STATE_CHOICES -
django/contrib/localflavor/uy/forms.py
2 2 """ 3 3 UY-specific form helpers. 4 4 """ 5 import re6 7 5 from django.core.validators import EMPTY_VALUES 8 6 from django.forms.fields import Select, RegexField 9 7 from django.forms import ValidationError -
django/contrib/localflavor/jp/forms.py
2 2 JP-specific Form helpers 3 3 """ 4 4 5 from django.forms import ValidationError6 5 from django.utils.translation import ugettext_lazy as _ 7 6 from django.forms.fields import RegexField, Select 8 7 -
django/contrib/localflavor/no/forms.py
2 2 Norwegian-specific Form helpers 3 3 """ 4 4 5 import re, datetime 5 import re 6 import datetime 6 7 from django.core.validators import EMPTY_VALUES 7 8 from django.forms import ValidationError 8 9 from django.forms.fields import Field, RegexField, Select -
django/contrib/localflavor/ro/forms.py
2 2 """ 3 3 Romanian specific form helpers. 4 4 """ 5 6 import re7 8 5 from django.core.validators import EMPTY_VALUES 9 6 from django.forms import ValidationError, Field, RegexField, Select 10 7 from django.utils.translation import ugettext_lazy as _ -
django/contrib/localflavor/pt/forms.py
1 1 """ 2 2 PT-specific Form helpers 3 3 """ 4 import re 4 5 5 6 from django.core.validators import EMPTY_VALUES 6 7 from django.forms import ValidationError 7 from django.forms.fields import Field, RegexField , Select8 from django.forms.fields import Field, RegexField 8 9 from django.utils.encoding import smart_unicode 9 10 from django.utils.translation import ugettext_lazy as _ 10 import re11 11 12 12 phone_digits_re = re.compile(r'^(\d{9}|(00|\+)\d*)$') 13 13 -
django/contrib/localflavor/ru/forms.py
3 3 """ 4 4 import re 5 5 6 from django.core.validators import EMPTY_VALUES 7 from django.forms import ValidationError 8 from django.forms.fields import CharField, Select, RegexField 6 from django.forms.fields import RegexField, Select 9 7 from django.utils.translation import ugettext_lazy as _ 10 8 11 9 phone_digits_re = re.compile(r'^(?:[78]-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$') -
django/contrib/localflavor/ar/forms.py
6 6 from django.forms import ValidationError 7 7 from django.core.validators import EMPTY_VALUES 8 8 from django.forms.fields import RegexField, CharField, Select 9 from django.utils.encoding import smart_unicode10 9 from django.utils.translation import ugettext_lazy as _ 11 10 12 11 class ARProvinceSelect(Select): -
django/contrib/localflavor/au/models.py
1 from django.conf import settings2 1 from django.utils.translation import ugettext_lazy as _ 3 2 from django.db.models.fields import CharField 4 3 -
django/contrib/localflavor/se/utils.py
1 import re2 1 import datetime 3 2 4 3 def id_number_checksum(gd): -
django/contrib/sessions/backends/base.py
2 2 import hashlib 3 3 import os 4 4 import random 5 import sys6 5 import time 7 6 from datetime import datetime, timedelta 8 7 try: -
django/contrib/sessions/backends/db.py
1 1 import datetime 2 from django.conf import settings3 2 from django.contrib.sessions.backends.base import SessionBase, CreateError 4 3 from django.core.exceptions import SuspiciousOperation 5 4 from django.db import IntegrityError, transaction, router -
django/contrib/sessions/models.py
1 import base642 import cPickle as pickle3 4 1 from django.db import models 5 2 from django.utils.translation import ugettext_lazy as _ 6 3 -
django/contrib/messages/api.py
1 1 from django.contrib.messages import constants 2 2 from django.contrib.messages.storage import default_storage 3 from django.utils.functional import lazy, memoize4 3 5 4 __all__ = ( 6 5 'add_message', 'get_messages', -
django/contrib/messages/tests/cookie.py
1 1 from django.contrib.messages import constants 2 2 from django.contrib.messages.tests.base import BaseTest 3 from django.contrib.messages.storage.cookie import CookieStorage, \4 MessageEncoder, MessageDecoder3 from django.contrib.messages.storage.cookie import (CookieStorage, 4 MessageEncoder, MessageDecoder) 5 5 from django.contrib.messages.storage.base import Message 6 6 from django.utils import simplejson as json 7 7 from django.conf import settings -
django/contrib/messages/tests/base.py
1 import warnings2 3 1 from django import http 4 2 from django.test import TestCase 5 3 from django.conf import settings -
django/contrib/messages/tests/fallback.py
1 1 from django.contrib.messages import constants 2 from django.contrib.messages.storage.fallback import FallbackStorage, \3 CookieStorage 2 from django.contrib.messages.storage.fallback import (FallbackStorage, 3 CookieStorage) 4 4 from 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 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) 9 9 10 10 11 11 class FallbackTest(BaseTest): -
django/contrib/messages/tests/urls.py
2 2 from django.contrib import messages 3 3 from django.core.urlresolvers import reverse 4 4 from django.http import HttpResponseRedirect, HttpResponse 5 from django.shortcuts import render_to_response, redirect6 5 from django.template import RequestContext, Template 7 6 from django.template.response import TemplateResponse 8 7 from django.views.decorators.cache import never_cache -
django/contrib/messages/storage/cookie.py
1 1 from django.conf import settings 2 from django.contrib.messages import constants3 2 from django.contrib.messages.storage.base import BaseStorage, Message 4 3 from django.http import SimpleCookie 5 4 from django.utils import simplejson as json -
django/bin/profiling/gather_profile_stats.py
8 8 """ 9 9 10 10 from hotshot import stats 11 import os 11 12 import pstats 12 import sys , os13 import sys 13 14 14 15 def gather_stats(p): 15 16 profiles = {} -
django/template/base.py
1 import imp2 1 import re 3 2 from functools import partial 4 3 from inspect import getargspec … … 7 6 from django.template.context import Context, RequestContext, ContextPopException 8 7 from django.utils.importlib import import_module 9 8 from django.utils.itercompat import is_iterable 10 from django.utils.functional import Promise11 9 from django.utils.text import smart_split, unescape_string_literal, get_text_list 12 10 from django.utils.encoding import smart_unicode, force_unicode, smart_str 13 11 from django.utils.translation import ugettext_lazy -
django/template/loaders/cached.py
4 4 """ 5 5 6 6 import hashlib 7 from django.core.exceptions import ImproperlyConfigured8 7 from django.template.base import TemplateDoesNotExist 9 8 from django.template.loader import BaseLoader, get_template_from_string, find_template_loader, make_origin 10 from django.utils.importlib import import_module11 9 12 10 class Loader(BaseLoader): 13 11 is_usable = True -
django/template/defaulttags.py
5 5 from datetime import datetime 6 6 from itertools import groupby, cycle as itertools_cycle 7 7 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 8 from django.template.base import Node, NodeList, Template 9 from 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) 10 14 from django.template.base import get_library, Library, InvalidTemplateLibrary 11 15 from django.template.smartif import IfParser, Literal 12 16 from django.template.defaultfilters import date -
django/template/context.py
1 1 from copy import copy 2 2 from django.core.exceptions import ImproperlyConfigured 3 3 from django.utils.importlib import import_module 4 from django.http import HttpRequest5 4 6 5 # Cache of actual callables. 7 6 _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 1 from django.template.base import TemplateSyntaxError, Library, Node, TextNode 4 2 from django.template.defaulttags import token_kwargs 5 3 from django.template.loader import get_template 6 4 from django.conf import settings -
django/template/smartif.py
1 1 """ 2 2 Parser and utilities for the smart 'if' tag 3 3 """ 4 import operator5 4 6 5 # Using a simple top down parser, as described here: 7 6 # http://effbot.org/zone/simple-top-down-parsing.htm. -
django/template/debug.py
1 from django.conf import settings2 1 from django.template.base import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError 3 2 from django.utils.encoding import force_unicode 4 3 from django.utils.html import escape -
django/middleware/http.py
1 from django.core.exceptions import MiddlewareNotUsed2 1 from django.utils.http import http_date, parse_http_date_safe 3 2 4 3 class ConditionalGetMiddleware(object): -
tests/modeltests/field_subclassing/models.py
5 5 from django.db import models 6 6 from django.utils.encoding import force_unicode 7 7 8 from fields import Small , SmallField, SmallerField, JSONField8 from fields import SmallField, SmallerField, JSONField 9 9 10 10 11 11 class MyModel(models.Model): -
tests/modeltests/field_subclassing/fields.py
1 from django.core.exceptions import FieldError2 1 from django.db import models 3 2 from django.utils import simplejson as json 4 3 from django.utils.encoding import force_unicode -
tests/modeltests/proxy_models/models.py
5 5 providing a modified interface to the data from the base class. 6 6 """ 7 7 8 from django.contrib.contenttypes.models import ContentType9 8 from django.db import models 10 9 11 10 -
tests/modeltests/mutually_referential/tests.py
1 1 from django.test import TestCase 2 from models import Parent , Child2 from models import Parent 3 3 4 4 class MutuallyReferentialTests(TestCase): 5 5 -
tests/modeltests/files/tests.py
1 1 from __future__ import with_statement 2 2 3 3 import shutil 4 import sys5 4 import tempfile 6 5 7 6 from django.core.cache import cache -
tests/modeltests/files/models.py
9 9 import tempfile 10 10 11 11 from django.db import models 12 from django.core.files.base import ContentFile13 12 from django.core.files.storage import FileSystemStorage 14 13 15 14 -
tests/modeltests/get_or_create/models.py
6 6 parameters. 7 7 """ 8 8 9 from django.db import models , IntegrityError9 from django.db import models 10 10 11 11 class Person(models.Model): 12 12 first_name = models.CharField(max_length=100) -
tests/modeltests/unmanaged_models/tests.py
1 1 from django.test import TestCase 2 2 from django.db import connection 3 from models import Unmanaged1, Unmanaged2, Managed1 4 from models import A01, A02, B01, B02, C01, C02 3 from models import A01, A02, B01, B02, C01, C02, Unmanaged2, Managed1 5 4 6 5 class SimpleTests(TestCase): 7 6 -
tests/modeltests/custom_pk/tests.py
1 1 # -*- coding: utf-8 -*- 2 from django.conf import settings 3 from django.db import DEFAULT_DB_ALIAS, transaction, IntegrityError 2 from django.db import transaction, IntegrityError 4 3 from django.test import TestCase, skipIfDBFeature 5 4 6 5 from models import Employee, Business, Bar, Foo -
tests/modeltests/custom_pk/models.py
6 6 this behavior by explicitly adding ``primary_key=True`` to a field. 7 7 """ 8 8 9 from django.conf import settings 10 from django.db import models, transaction, IntegrityError, DEFAULT_DB_ALIAS 9 from django.db import models 11 10 12 11 from fields import MyAutoField 13 12 -
tests/modeltests/lookup/tests.py
1 1 from datetime import datetime 2 2 from operator import attrgetter 3 3 from django.core.exceptions import FieldError 4 from django.db import connection5 4 from django.test import TestCase, skipUnlessDBFeature 6 5 from models import Author, Article, Tag 7 6 -
tests/modeltests/lookup/models.py
4 4 This demonstrates features of the database API. 5 5 """ 6 6 7 from django.db import models, DEFAULT_DB_ALIAS, connection 8 from django.conf import settings 7 from django.db import models 9 8 10 9 class Author(models.Model): 11 10 name = models.CharField(max_length=100) -
tests/modeltests/proxy_model_inheritance/tests.py
9 9 import os 10 10 import sys 11 11 12 from django.conf import settings , Settings12 from django.conf import settings 13 13 from django.core.management import call_command 14 14 from django.db.models.loading import load_app 15 15 from django.test import TransactionTestCase -
tests/modeltests/get_object_or_404/models.py
11 11 """ 12 12 13 13 from django.db import models 14 from django.http import Http40415 from django.shortcuts import get_object_or_404, get_list_or_40416 14 17 15 class Author(models.Model): 18 16 name = models.CharField(max_length=50) -
tests/modeltests/delete/models.py
1 from django.db import models , IntegrityError1 from django.db import models 2 2 3 3 4 4 class R(models.Model): -
tests/modeltests/fixtures_model_package/models/__init__.py
1 1 from django.db import models 2 from django.conf import settings3 2 4 3 class Article(models.Model): 5 4 headline = models.CharField(max_length=100, default='Default headline') -
tests/modeltests/model_forms/models.py
7 7 words, most of these tests should be rewritten. 8 8 """ 9 9 10 import os11 10 import tempfile 12 11 13 12 from django.db import models -
tests/modeltests/many_to_one/tests.py
2 2 from datetime import datetime 3 3 4 4 from django.test import TestCase 5 from django.core.exceptions import FieldError,MultipleObjectsReturned5 from django.core.exceptions import MultipleObjectsReturned 6 6 7 7 from models import Article, Reporter 8 8 -
tests/modeltests/basic/tests.py
1 1 from datetime import datetime 2 2 3 3 from django.core.exceptions import ObjectDoesNotExist 4 from django.db import models, DEFAULT_DB_ALIAS, connection5 4 from django.db.models.fields import FieldDoesNotExist 6 5 from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature 7 6 -
tests/modeltests/basic/models.py
4 4 5 5 This is a basic model with only two non-primary-key fields. 6 6 """ 7 from django.db import models , DEFAULT_DB_ALIAS, connection7 from django.db import models 8 8 9 9 class Article(models.Model): 10 10 headline = models.CharField(max_length=100, default='Default headline') -
tests/modeltests/force_insert_update/models.py
2 2 Tests for forcing insert and update queries (instead of Django's normal 3 3 automatic behaviour). 4 4 """ 5 from django.db import models , transaction, IntegrityError5 from django.db import models 6 6 7 7 class Counter(models.Model): 8 8 name = models.CharField(max_length = 10) -
tests/modeltests/one_to_one/models.py
6 6 In this example, a ``Place`` optionally can be a ``Restaurant``. 7 7 """ 8 8 9 from django.db import models , transaction, IntegrityError9 from django.db import models 10 10 11 11 class Place(models.Model): 12 12 name = models.CharField(max_length=50) -
tests/modeltests/validation/validators.py
1 from django.utils.unittest import TestCase2 3 1 from modeltests.validation import ValidationTestCase 4 2 from models import * 5 3 -
tests/modeltests/validation/models.py
1 1 from datetime import datetime 2 2 from django.core.exceptions import ValidationError 3 3 from django.db import models 4 from django.test import TestCase5 4 6 5 7 6 def validate_answer_to_universe(value): -
tests/modeltests/validation/test_unique.py
2 2 3 3 import datetime 4 4 5 from django.conf import settings6 5 from django.core.exceptions import ValidationError 7 from django.db import connection8 6 from django.test import TestCase 9 7 from django.utils import unittest 10 8 -
tests/modeltests/m2m_through/tests.py
3 3 4 4 from django.test import TestCase 5 5 6 from models import Person, Group, Membership, CustomMembership, \7 TestNoDefaultsOrNulls, PersonSelfRefM2M, Friendship6 from models import (Person, Group, Membership, CustomMembership, 7 PersonSelfRefM2M, Friendship) 8 8 9 9 10 10 class M2mThroughTests(TestCase): -
tests/modeltests/transactions/tests.py
1 1 from __future__ import with_statement 2 2 3 import sys 4 5 from django.db import connection, transaction, IntegrityError, DEFAULT_DB_ALIAS 6 from django.conf import settings 3 from django.db import connection, transaction, IntegrityError 7 4 from django.test import TransactionTestCase, skipUnlessDBFeature 8 5 9 6 from models import Reporter -
tests/modeltests/transactions/models.py
7 7 manually. 8 8 """ 9 9 10 from django.db import models , DEFAULT_DB_ALIAS10 from django.db import models 11 11 12 12 class Reporter(models.Model): 13 13 first_name = models.CharField(max_length=30) -
tests/modeltests/model_formsets/tests.py
10 10 from django.test import TestCase, skipUnlessDBFeature 11 11 12 12 from modeltests.model_formsets.models import ( 13 Author, BetterAuthor, Book, BookWithCustomPK, Editor,13 Author, BetterAuthor, Book, BookWithCustomPK, 14 14 BookWithOptionalAltEditor, AlternateBook, AuthorMeeting, CustomPrimaryKey, 15 15 Place, Owner, Location, OwnerProfile, Restaurant, Product, Price, 16 16 MexicanRestaurant, ClassyMexicanRestaurant, Repository, Revision, -
tests/modeltests/pagination/tests.py
1 1 from datetime import datetime 2 from operator import attrgetter3 2 4 3 from django.core.paginator import Paginator, InvalidPage, EmptyPage 5 4 from django.test import TestCase -
tests/modeltests/serializers/tests.py
9 9 from django.test import TestCase, TransactionTestCase, Approximate 10 10 from django.utils import simplejson, unittest 11 11 12 from models import Category, Author, Article, AuthorProfile, Actor, \ 13 Movie, Score, Player, Team 12 from models import Category, Author, Article, AuthorProfile, Actor, Movie, Score, Player, Team 14 13 15 14 class SerializerRegistrationTests(unittest.TestCase): 16 15 def setUp(self): -
tests/modeltests/fixtures/tests.py
1 1 import StringIO 2 import sys3 2 4 from django.conf import settings5 3 from django.contrib.sites.models import Site 6 4 from django.core import management 7 from django.db import DEFAULT_DB_ALIAS8 5 from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature 9 6 10 from models import Article, B log, Book, Category, Person, Spy, Tag, Visa7 from models import Article, Book, Spy, Tag, Visa 11 8 12 9 13 10 class TestCaseFixtureLoadingTests(TestCase): -
tests/modeltests/fixtures/models.py
11 11 from django.contrib.auth.models import Permission 12 12 from django.contrib.contenttypes import generic 13 13 from django.contrib.contenttypes.models import ContentType 14 from django.db import models, DEFAULT_DB_ALIAS 15 from django.conf import settings 14 from django.db import models 16 15 17 16 18 17 class Category(models.Model): -
tests/regressiontests/defer_regress/tests.py
1 1 from operator import attrgetter 2 2 3 from django.conf import settings4 3 from django.contrib.contenttypes.models import ContentType 5 4 from django.contrib.sessions.backends.db import SessionStore 6 from django.db import connection7 5 from django.db.models import Count 8 6 from django.db.models.loading import cache 9 7 from django.test import TestCase -
tests/regressiontests/defer_regress/models.py
2 2 Regression tests for defer() / only() behavior. 3 3 """ 4 4 5 from django.conf import settings 6 from django.contrib.contenttypes.models import ContentType 7 from django.db import connection, models 5 from django.db import models 8 6 9 7 class Item(models.Model): 10 8 name = models.CharField(max_length=15) -
tests/regressiontests/admin_filters/tests.py
1 from __future__ import with_statement2 3 1 import datetime 4 2 5 3 from django.core.exceptions import ImproperlyConfigured -
tests/regressiontests/test_utils/tests.py
1 1 from __future__ import with_statement 2 2 3 import sys 4 5 from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature 3 from django.test import TestCase, skipUnlessDBFeature 6 4 from django.utils.unittest import skip 7 5 8 6 from models import Person -
tests/regressiontests/cache/tests.py
2 2 3 3 # Unit tests for cache framework 4 4 # Uses whatever cache backend is set in the test settings file. 5 from __future__ import with_statement6 5 7 6 import hashlib 8 7 import os -
tests/regressiontests/multiple_database/models.py
1 from django.conf import settings2 1 from django.contrib.auth.models import User 3 2 from django.contrib.contenttypes.models import ContentType 4 3 from django.contrib.contenttypes import generic -
tests/regressiontests/select_related_onetoone/tests.py
1 from django import db2 from django.conf import settings3 1 from django.test import TestCase 4 2 5 3 from models import (User, UserProfile, UserStat, UserStatResult, StatDetails, -
tests/regressiontests/delete_regress/tests.py
1 1 import datetime 2 2 3 3 from django.conf import settings 4 from django.db import backend, connection,transaction, DEFAULT_DB_ALIAS4 from django.db import backend, transaction, DEFAULT_DB_ALIAS 5 5 from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature 6 6 7 7 from models import (Book, Award, AwardNote, Person, Child, Toy, PlayedWith, 8 PlayedWithNote, Contact,Email, Researcher, Food, Eaten,8 PlayedWithNote, Email, Researcher, Food, Eaten, 9 9 Policy, Version, Location, Item) 10 10 11 11 -
tests/regressiontests/views/tests/debug.py
9 9 from django.core.urlresolvers import reverse 10 10 from django.template import TemplateSyntaxError 11 11 from django.views.debug import ExceptionReporter 12 from django.core.exceptions import ImproperlyConfigured13 12 from django.core import mail 14 13 15 14 from regressiontests.views import BrokenException, except_args -
tests/regressiontests/views/tests/defaults.py
1 from os import path2 3 from django.conf import settings4 1 from django.test import TestCase 5 2 from django.contrib.contenttypes.models import ContentType 6 3 -
tests/regressiontests/model_forms_regress/tests.py
8 8 from django.utils import unittest 9 9 from django.test import TestCase 10 10 11 from models import Person, RealPerson, Triple, FilePathModel, Article, \12 Publication, CustomFF, Author, Author1, Homepage, Document, Edition 11 from models import (Person, RealPerson, Triple, FilePathModel, Article, 12 Publication, CustomFF, Author, Author1, Homepage, Document, Edition) 13 13 14 14 15 15 class ModelMultipleChoiceFieldTests(TestCase): -
tests/regressiontests/admin_validation/tests.py
1 1 from django.contrib import admin 2 2 from django import forms 3 from django.contrib.admin.validation import validate, validate_inline, \ 4 ImproperlyConfigured 3 from django.contrib.admin.validation import validate, validate_inline, ImproperlyConfigured 5 4 from django.test import TestCase 6 5 7 6 from models import Song, Book, Album, TwoAlbumFKAndAnE, State, City -
tests/regressiontests/file_storage/tests.py
18 18 19 19 from django.conf import settings 20 20 from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured 21 from django.core.files.base import ContentFile , File21 from django.core.files.base import ContentFile 22 22 from django.core.files.images import get_image_dimensions 23 23 from django.core.files.storage import FileSystemStorage, get_storage_class 24 24 from django.core.files.uploadedfile import UploadedFile -
tests/regressiontests/file_uploads/tests.py
9 9 10 10 from django.core.files import temp as tempfile 11 11 from django.core.files.uploadedfile import SimpleUploadedFile 12 from django.http.multipartparser import MultiPartParser , MultiPartParserError12 from django.http.multipartparser import MultiPartParser 13 13 from django.test import TestCase, client 14 14 from django.utils import simplejson 15 15 from django.utils import unittest -
tests/regressiontests/expressions_regress/tests.py
3 3 """ 4 4 import datetime 5 5 6 from django.conf import settings 7 from django.db import models, connection 6 from django.db import connection 8 7 from django.db.models import F 9 8 from django.test import TestCase, Approximate, skipUnlessDBFeature 10 9 -
tests/regressiontests/syndication/tests.py
1 import datetime2 import warnings3 1 from xml.dom import minidom 4 2 5 3 from django.contrib.syndication import views -
tests/regressiontests/comment_tests/tests/templatetag_tests.py
1 1 from django.contrib.comments.forms import CommentForm 2 from django.contrib.comments.models import Comment3 2 from django.contrib.contenttypes.models import ContentType 4 3 from django.template import Template, Context 5 4 from 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 1 from regressiontests.comment_tests.tests import CommentTestCase 3 2 from django.contrib.comments.models import Comment 4 3 from django.contrib.comments.moderation import moderator, CommentModerator, AlreadyModerated 5 4 from regressiontests.comment_tests.models import Entry -
tests/regressiontests/comment_tests/tests/feed_tests.py
1 import warnings2 3 from django.test.utils import get_warnings_state, restore_warnings_state4 5 1 from regressiontests.comment_tests.tests import CommentTestCase 6 2 7 3 -
tests/regressiontests/comment_tests/models.py
30 30 return self.title 31 31 32 32 class Book(models.Model): 33 dewey_decimal = models.DecimalField(primary_key =True, decimal_places=2, max_digits=5)33 dewey_decimal = models.DecimalField(primary_key=True, decimal_places=2, max_digits=5) 34 34 35 No newline at end of file -
tests/regressiontests/m2m_through_regress/models.py
1 from datetime import datetime2 3 1 from django.contrib.auth.models import User 4 from django.core import management5 2 from django.db import models 6 3 7 4 -
tests/regressiontests/signals_regress/tests.py
1 import sys2 from StringIO import StringIO3 1 from django.test import TestCase 4 2 5 3 from django.db import models -
tests/regressiontests/datatypes/tests.py
1 1 import datetime 2 2 3 from django.conf import settings4 from django.db import DEFAULT_DB_ALIAS5 3 from django.test import TestCase, skipIfDBFeature 6 4 from django.utils import tzinfo 7 5 -
tests/regressiontests/localflavor/tests.py
1 from django.test import TestCase2 from django.utils import unittest3 4 # just import your tests here5 1 from au.tests import * 6 2 from mk.tests import * 7 3 from us.tests import * -
tests/regressiontests/modeladmin/models.py
1 1 # coding: utf-8 2 from datetime import date3 4 2 from django.db import models 5 3 from django.contrib.auth.models import User 6 4 -
tests/regressiontests/max_lengths/tests.py
1 from django.db import DatabaseError2 1 from django.utils import unittest 3 2 from regressiontests.max_lengths.models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths 4 3 -
tests/regressiontests/extra_regress/tests.py
3 3 from django.utils.datastructures import SortedDict 4 4 5 5 from django.contrib.auth.models import User 6 from regressiontests.extra_regress.models import TestObject, Order, \ 7 RevisionableModel 6 from regressiontests.extra_regress.models import TestObject, Order, RevisionableModel 8 7 9 8 import datetime 10 9 -
tests/regressiontests/middleware_exceptions/models.py
1 from django.db import models -
tests/regressiontests/i18n/patterns/urls/wrong_namespace.py
1 from django.conf.urls.defaults import include,url1 from django.conf.urls.defaults import url 2 2 from django.conf.urls.i18n import i18n_patterns 3 3 from django.utils.translation import ugettext_lazy as _ 4 4 from django.views.generic import TemplateView -
tests/regressiontests/i18n/patterns/urls/namespace.py
1 from django.conf.urls.defaults import patterns, include,url1 from django.conf.urls.defaults import patterns, url 2 2 from django.utils.translation import ugettext_lazy as _ 3 3 from django.views.generic import TemplateView 4 4 -
tests/regressiontests/i18n/patterns/urls/wrong.py
1 from django.conf.urls.defaults import patterns,include, url1 from django.conf.urls.defaults import include, url 2 2 from django.conf.urls.i18n import i18n_patterns 3 3 from django.utils.translation import ugettext_lazy as _ 4 4 -
tests/regressiontests/i18n/forms.py
1 from django import template,forms1 from django import forms 2 2 from django.forms.extras import SelectDateWidget 3 3 4 from models import Company 4 5 5 6 class I18nForm(forms.Form): -
tests/regressiontests/csrf_tests/tests.py
1 1 # -*- coding: utf-8 -*- 2 2 from __future__ import with_statement 3 import warnings4 3 5 4 from django.test import TestCase 6 5 from django.http import HttpRequest, HttpResponse -
tests/regressiontests/model_fields/tests.py
12 12 13 13 # If PIL available, do these tests. 14 14 if 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) 23 23 24 24 25 25 class BasicFieldTests(test.TestCase): -
tests/regressiontests/model_fields/imagefield.py
2 2 import shutil 3 3 4 4 from django.core.files import File 5 from django.core.files.base import ContentFile6 5 from django.core.files.images import ImageFile 7 6 from django.test import TestCase 8 7 9 from models import Image, Person, PersonWithHeight, PersonWithHeightAndWidth, \10 PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile 8 from models import (Image, Person, PersonWithHeight, PersonWithHeightAndWidth, 9 PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile) 11 10 12 11 13 12 # If PIL available, do these tests. -
tests/regressiontests/generic_relations_regress/tests.py
1 1 from django.test import TestCase 2 from django.contrib.contenttypes.models import ContentType3 2 from django.db.models import Q 4 3 from models import * 5 4 -
tests/regressiontests/forms/tests/media.py
1 1 # -*- coding: utf-8 -*- 2 from django.conf import settings3 2 from django.forms import TextInput, Media, TextInput, CharField, Form, MultiWidget 4 3 from django.test import TestCase 5 4 from django.test.utils import override_settings -
tests/regressiontests/forms/tests/models.py
3 3 from django.core.files.uploadedfile import SimpleUploadedFile 4 4 from django.forms import Form, ModelForm, FileField, ModelChoiceField 5 5 from django.test import TestCase 6 from regressiontests.forms.models import ChoiceModel, ChoiceOptionModel, ChoiceFieldModel, FileModel, Group, BoundaryModel, Defaults 6 from regressiontests.forms.models import (ChoiceOptionModel, ChoiceFieldModel, 7 FileModel, Group, BoundaryModel, Defaults) 7 8 8 9 9 10 class ChoiceFieldForm(ModelForm): -
tests/regressiontests/forms/tests/fields.py
33 33 34 34 from django.core.files.uploadedfile import SimpleUploadedFile 35 35 from django.forms import * 36 from django.forms.widgets import RadioFieldRenderer37 36 from django.utils.unittest import TestCase 38 37 39 38 -
tests/regressiontests/forms/tests/forms.py
1 1 # -*- coding: utf-8 -*- 2 2 import datetime 3 from decimal import Decimal4 import re5 import time6 3 from django.core.files.uploadedfile import SimpleUploadedFile 7 4 from django.forms import * 8 5 from django.http import QueryDict -
tests/regressiontests/forms/tests/widgets.py
2 2 3 3 import copy 4 4 import datetime 5 import re6 import time7 from decimal import Decimal8 5 from django.conf import settings 9 6 from django.core.files.uploadedfile import SimpleUploadedFile 10 7 from django.forms import * -
tests/regressiontests/forms/localflavor/in_.py
1 import warnings2 3 1 from django.contrib.localflavor.in_.forms import (INZipCodeField, 4 2 INStateField, INStateSelect, INPhoneNumberField) 5 3 -
tests/regressiontests/forms/localflavor/cl.py
1 1 from django.contrib.localflavor.cl.forms import CLRutField, CLRegionSelect 2 from django.core.exceptions import ValidationError3 2 4 3 from utils import LocalFlavorTestCase 5 4 -
tests/regressiontests/serializers_regress/tests.py
15 15 except ImportError: 16 16 from StringIO import StringIO 17 17 18 from django.conf import settings 19 from django.core import serializers, management 18 from django.core import serializers 20 19 from django.core.serializers import SerializerDoesNotExist 21 from django.db import transaction, DEFAULT_DB_ALIAS,connection20 from django.db import connection 22 21 from django.test import TestCase 23 22 from django.utils.functional import curry 24 23 -
tests/regressiontests/generic_views/base.py
4 4 from django.core.exceptions import ImproperlyConfigured 5 5 from django.http import HttpResponse 6 6 from django.test import TestCase, RequestFactory 7 from django.utils import simplejson8 7 from django.views.generic import View, TemplateView, RedirectView 9 8 10 9 -
tests/regressiontests/generic_views/list.py
2 2 from django.test import TestCase 3 3 4 4 from regressiontests.generic_views.models import Author, Artist 5 from regressiontests.generic_views.views import CustomPaginator6 5 7 6 class ListViewTests(TestCase): 8 7 fixtures = ['generic-views-test-data.json'] -
tests/regressiontests/generic_views/dates.py
1 1 import datetime 2 import random3 2 4 3 from django.core.exceptions import ImproperlyConfigured 5 4 from django.test import TestCase -
tests/regressiontests/templates/loaders.py
14 14 import imp 15 15 import StringIO 16 16 import os.path 17 import warnings18 17 19 18 from django.template import TemplateDoesNotExist, Context 20 19 from django.template.loaders.eggs import Loader as EggLoader 21 20 from django.template import loader 22 from django.test.utils import get_warnings_state, restore_warnings_state23 21 from django.utils import unittest 24 22 25 23 -
tests/regressiontests/templates/response.py
6 6 from django.test import RequestFactory, TestCase 7 7 from django.conf import settings 8 8 import django.template.context 9 from django.template import Template, Context , RequestContext9 from django.template import Template, Context 10 10 from django.template.response import (TemplateResponse, SimpleTemplateResponse, 11 11 ContentNotRenderedError) 12 12 -
tests/regressiontests/templates/tests.py
15 15 from urlparse import urljoin 16 16 17 17 from django import template 18 from django.template import base as template_base 18 from django.template import base as template_base, RequestContext 19 19 from django.core import urlresolvers 20 20 from django.template import loader 21 21 from django.template.loaders import app_directories, filesystem, cached 22 from django.test.utils import get_warnings_state, restore_warnings_state,\23 setup_test_template_loader, restore_template_loaders 22 from django.test.utils import (get_warnings_state, restore_warnings_state, 23 setup_test_template_loader, restore_template_loaders) 24 24 from django.utils import unittest 25 25 from django.utils.formats import date_format 26 26 from django.utils.translation import activate, deactivate, ugettext as _ -
tests/regressiontests/templates/smartif.py
1 from django.template.smartif import IfParser , Literal1 from django.template.smartif import IfParser 2 2 from django.utils import unittest 3 3 4 4 class SmartIfTests(unittest.TestCase): -
tests/regressiontests/templates/custom.py
1 from __future__ import with_statement2 3 1 from django import template 4 2 from django.utils.unittest import TestCase 5 3 from templatetags import custom -
tests/regressiontests/introspection/tests.py
1 1 from functools import update_wrapper 2 from django.conf import settings 3 from django.db import connection, DEFAULT_DB_ALIAS 2 from django.db import connection 4 3 from django.test import TestCase, skipUnlessDBFeature 5 4 6 5 from models import Reporter, Article -
tests/regressiontests/utils/jslex.py
2 2 # encoding: utf-8 3 3 # originally from https://bitbucket.org/ned/jslex 4 4 5 import difflib6 5 from django.test import TestCase 7 6 from django.utils.jslex import JsLexer, prepare_js_for_gettext 8 7 -
tests/regressiontests/fixtures_regress/tests.py
2 2 # Unittests for fixtures. 3 3 import os 4 4 import re 5 import sys6 5 try: 7 6 from cStringIO import StringIO 8 7 except ImportError: … … 13 12 from django.core.management.base import CommandError 14 13 from django.db.models import signals 15 14 from django.db import transaction 16 from django.test import TestCase, TransactionTestCase, skipIfDBFeature, \17 skipUnlessDBFeature 15 from django.test import (TestCase, TransactionTestCase, skipIfDBFeature, 16 skipUnlessDBFeature) 18 17 19 18 from models import Animal, Stuff 20 19 from models import Absolute, Parent, Child -
tests/regressiontests/fixtures_regress/models.py
1 from django.db import models , DEFAULT_DB_ALIAS, connection1 from django.db import models 2 2 from django.contrib.auth.models import User 3 from django.conf import settings4 3 5 4 6 5 class Animal(models.Model): -
tests/regressiontests/bash_completion/management/commands/test_command.py
1 import sys, os 2 from optparse import OptionParser, make_option 1 from optparse import make_option 3 2 4 3 from django.core.management.base import BaseCommand 5 4 -
tests/regressiontests/urlpatterns_reverse/tests.py
3 3 """ 4 4 from django.conf import settings 5 5 from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist 6 from django.core.urlresolvers import reverse, resolve, NoReverseMatch,\ 7 Resolver404, ResolverMatch,\ 8 RegexURLResolver, RegexURLPattern 6 from django.core.urlresolvers import (reverse, resolve, NoReverseMatch, 7 Resolver404, ResolverMatch, RegexURLResolver, RegexURLPattern) 9 8 from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect 10 9 from django.shortcuts import redirect 11 10 from django.test import TestCase -
tests/regressiontests/urlpatterns_reverse/middleware.py
1 from django.core.urlresolvers import set_urlconf2 3 1 import urlconf_inner 4 2 5 3 class ChangeURLconfMiddleware(object):