diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/forms.py b/django/contrib/formtools/tests/wizard/namedwizardtests/forms.py index c89f51e179cb0..fa9071d9dbe32 100644 --- a/django/contrib/formtools/tests/wizard/namedwizardtests/forms.py +++ b/django/contrib/formtools/tests/wizard/namedwizardtests/forms.py @@ -14,21 +14,25 @@ temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR')) temp_storage = FileSystemStorage(location=temp_storage_location) + class Page1(forms.Form): name = forms.CharField(max_length=100) user = forms.ModelChoiceField(queryset=User.objects.all()) thirsty = forms.NullBooleanField() + class Page2(forms.Form): address1 = forms.CharField(max_length=100) address2 = forms.CharField(max_length=100) file1 = forms.FileField() + class Page3(forms.Form): random_crap = forms.CharField(max_length=100) Page4 = formset_factory(Page3, extra=2) + class ContactWizard(NamedUrlWizardView): file_storage = temp_storage @@ -44,8 +48,10 @@ def done(self, form_list, **kwargs): c['this_will_fail'] = self.get_cleaned_data_for_step('this_will_fail') return HttpResponse(Template('').render(c)) + class SessionContactWizard(ContactWizard): storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage' + class CookieContactWizard(ContactWizard): storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage' diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/urls.py b/django/contrib/formtools/tests/wizard/namedwizardtests/urls.py index ac2cadc321a74..a88e711720849 100644 --- a/django/contrib/formtools/tests/wizard/namedwizardtests/urls.py +++ b/django/contrib/formtools/tests/wizard/namedwizardtests/urls.py @@ -2,6 +2,7 @@ from django.contrib.formtools.tests.wizard.namedwizardtests.forms import ( SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4) + def get_named_session_wizard(): return SessionContactWizard.as_view( [('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)], @@ -9,6 +10,7 @@ def get_named_session_wizard(): done_step_name='nwiz_session_done' ) + def get_named_cookie_wizard(): return CookieContactWizard.as_view( [('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)], diff --git a/django/contrib/formtools/tests/wizard/test_forms.py b/django/contrib/formtools/tests/wizard/test_forms.py index ba3fbfdd4897f..386e4484858f5 100644 --- a/django/contrib/formtools/tests/wizard/test_forms.py +++ b/django/contrib/formtools/tests/wizard/test_forms.py @@ -81,12 +81,14 @@ def get_form_kwargs(self, step, *args, **kwargs): kwargs['test'] = True return kwargs + class TestWizardWithInitAttrs(TestWizard): form_list = [Step1, Step2] condition_dict = {'step2': True} initial_dict = {'start': {'name': 'value1'}} instance_dict = {'start': User()} + class FormTests(TestCase): def test_form_init(self): testform = TestWizard.get_initkwargs([Step1, Step2]) diff --git a/django/contrib/formtools/tests/wizard/wizardtests/forms.py b/django/contrib/formtools/tests/wizard/wizardtests/forms.py index ad565478d1eb8..5e4617c1cd758 100644 --- a/django/contrib/formtools/tests/wizard/wizardtests/forms.py +++ b/django/contrib/formtools/tests/wizard/wizardtests/forms.py @@ -15,21 +15,25 @@ temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR')) temp_storage = FileSystemStorage(location=temp_storage_location) + class Page1(forms.Form): name = forms.CharField(max_length=100) user = forms.ModelChoiceField(queryset=User.objects.all()) thirsty = forms.NullBooleanField() + class Page2(forms.Form): address1 = forms.CharField(max_length=100) address2 = forms.CharField(max_length=100) file1 = forms.FileField() + class Page3(forms.Form): random_crap = forms.CharField(max_length=100) Page4 = formset_factory(Page3, extra=2) + class ContactWizard(WizardView): file_storage = temp_storage @@ -51,6 +55,7 @@ def get_context_data(self, form, **kwargs): context.update({'another_var': True}) return context + class UserForm(forms.ModelForm): class Meta: model = User @@ -58,8 +63,10 @@ class Meta: UserFormSet = modelformset_factory(User, form=UserForm) + class SessionContactWizard(ContactWizard): storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage' + class CookieContactWizard(ContactWizard): storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage' diff --git a/django/contrib/formtools/wizard/forms.py b/django/contrib/formtools/wizard/forms.py index bf46c5c992fdc..cd00517fa3c0b 100644 --- a/django/contrib/formtools/wizard/forms.py +++ b/django/contrib/formtools/wizard/forms.py @@ -1,5 +1,6 @@ from django import forms + class ManagementForm(forms.Form): """ ``ManagementForm`` is used to keep track of the current wizard step. diff --git a/django/contrib/formtools/wizard/storage/exceptions.py b/django/contrib/formtools/wizard/storage/exceptions.py index e273a8654b412..31cea93ba8768 100644 --- a/django/contrib/formtools/wizard/storage/exceptions.py +++ b/django/contrib/formtools/wizard/storage/exceptions.py @@ -1,7 +1,9 @@ from django.core.exceptions import ImproperlyConfigured + class MissingStorage(ImproperlyConfigured): pass + class NoFileStorageConfigured(ImproperlyConfigured): pass diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py index f1c54f5df4d87..f19cfc76f3aeb 100644 --- a/django/contrib/formtools/wizard/views.py +++ b/django/contrib/formtools/wizard/views.py @@ -28,6 +28,7 @@ def normalize_name(name): new = re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', name) return new.lower().strip('_') + class StepsHelper(object): def __init__(self, wizard): diff --git a/django/contrib/gis/admin/options.py b/django/contrib/gis/admin/options.py index 6ec6a23ffde53..53a043c8f1e22 100644 --- a/django/contrib/gis/admin/options.py +++ b/django/contrib/gis/admin/options.py @@ -3,6 +3,7 @@ from django.contrib.gis.gdal import OGRGeomType from django.contrib.gis.db import models + class GeoModelAdmin(ModelAdmin): """ The administration options class for Geographic models. Map settings diff --git a/django/contrib/gis/db/backends/base.py b/django/contrib/gis/db/backends/base.py index 3162ed3d00100..4da0af0d27010 100644 --- a/django/contrib/gis/db/backends/base.py +++ b/django/contrib/gis/db/backends/base.py @@ -143,6 +143,7 @@ def geometry_columns(self): def spatial_ref_sys(self): raise NotImplementedError('subclasses of BaseSpatialOperations must a provide spatial_ref_sys() method') + @python_2_unicode_compatible class SpatialRefSysMixin(object): """ diff --git a/django/contrib/gis/db/backends/mysql/compiler.py b/django/contrib/gis/db/backends/mysql/compiler.py index f4654eff84015..74e666c165d6d 100644 --- a/django/contrib/gis/db/backends/mysql/compiler.py +++ b/django/contrib/gis/db/backends/mysql/compiler.py @@ -3,6 +3,7 @@ SQLCompiler = compiler.SQLCompiler + class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler): def resolve_columns(self, row, fields=()): """ @@ -19,17 +20,22 @@ def resolve_columns(self, row, fields=()): class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler): pass + class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler): pass + class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler): pass + class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler): pass + class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler): pass + class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, GeoSQLCompiler): pass diff --git a/django/contrib/gis/db/backends/mysql/creation.py b/django/contrib/gis/db/backends/mysql/creation.py index dda77ea6abd39..303b8aef539a1 100644 --- a/django/contrib/gis/db/backends/mysql/creation.py +++ b/django/contrib/gis/db/backends/mysql/creation.py @@ -1,7 +1,7 @@ from django.db.backends.mysql.creation import DatabaseCreation -class MySQLCreation(DatabaseCreation): +class MySQLCreation(DatabaseCreation): def sql_indexes_for_field(self, model, f, style): from django.contrib.gis.db.models.fields import GeometryField output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style) diff --git a/django/contrib/gis/db/backends/mysql/introspection.py b/django/contrib/gis/db/backends/mysql/introspection.py index 59d0f627ee358..aae1c1460c688 100644 --- a/django/contrib/gis/db/backends/mysql/introspection.py +++ b/django/contrib/gis/db/backends/mysql/introspection.py @@ -3,6 +3,7 @@ from django.contrib.gis.gdal import OGRGeomType from django.db.backends.mysql.introspection import DatabaseIntrospection + class MySQLIntrospection(DatabaseIntrospection): # Updating the data_types_reverse dictionary with the appropriate # type for Geometry fields. diff --git a/django/contrib/gis/db/backends/oracle/adapter.py b/django/contrib/gis/db/backends/oracle/adapter.py index ea340d93d95b2..ca627bd37dc92 100644 --- a/django/contrib/gis/db/backends/oracle/adapter.py +++ b/django/contrib/gis/db/backends/oracle/adapter.py @@ -1,5 +1,6 @@ from cx_Oracle import CLOB from django.contrib.gis.db.backends.adapter import WKTAdapter + class OracleSpatialAdapter(WKTAdapter): input_size = CLOB diff --git a/django/contrib/gis/db/backends/oracle/compiler.py b/django/contrib/gis/db/backends/oracle/compiler.py index d00af7fa7189f..4fe65bce28d0b 100644 --- a/django/contrib/gis/db/backends/oracle/compiler.py +++ b/django/contrib/gis/db/backends/oracle/compiler.py @@ -3,23 +3,30 @@ SQLCompiler = compiler.SQLCompiler + class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler): pass + class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler): pass + class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler): pass + class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler): pass + class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler): pass + class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler): pass + class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, GeoSQLCompiler): pass diff --git a/django/contrib/gis/db/backends/oracle/creation.py b/django/contrib/gis/db/backends/oracle/creation.py index 14f8d4d150fa8..4aa031220bcf6 100644 --- a/django/contrib/gis/db/backends/oracle/creation.py +++ b/django/contrib/gis/db/backends/oracle/creation.py @@ -1,6 +1,7 @@ from django.db.backends.oracle.creation import DatabaseCreation from django.db.backends.utils import truncate_name + class OracleCreation(DatabaseCreation): def sql_indexes_for_field(self, model, f, style): diff --git a/django/contrib/gis/db/backends/oracle/introspection.py b/django/contrib/gis/db/backends/oracle/introspection.py index d6c8f452df6e5..fbac2287e8e5c 100644 --- a/django/contrib/gis/db/backends/oracle/introspection.py +++ b/django/contrib/gis/db/backends/oracle/introspection.py @@ -3,6 +3,7 @@ from django.db.backends.oracle.introspection import DatabaseIntrospection from django.utils import six + class OracleIntrospection(DatabaseIntrospection): # Associating any OBJECTVAR instances with GeometryField. Of course, # this won't work right on Oracle objects that aren't MDSYS.SDO_GEOMETRY, diff --git a/django/contrib/gis/db/backends/oracle/models.py b/django/contrib/gis/db/backends/oracle/models.py index dda698481e7d3..c907b8280dfb1 100644 --- a/django/contrib/gis/db/backends/oracle/models.py +++ b/django/contrib/gis/db/backends/oracle/models.py @@ -11,6 +11,7 @@ from django.contrib.gis.db.backends.base import SpatialRefSysMixin from django.utils.encoding import python_2_unicode_compatible + @python_2_unicode_compatible class GeometryColumns(models.Model): "Maps to the Oracle USER_SDO_GEOM_METADATA table." @@ -42,6 +43,7 @@ def geom_col_name(cls): def __str__(self): return '%s - %s (SRID: %s)' % (self.table_name, self.column_name, self.srid) + class SpatialRefSys(models.Model, SpatialRefSysMixin): "Maps to the Oracle MDSYS.CS_SRS table." cs_name = models.CharField(max_length=68) diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index 5fced474c8e19..14df0ff1d369e 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -28,6 +28,7 @@ def __init__(self, func, **kwargs): kwargs.setdefault('result', 'TRUE') super(SDOOperation, self).__init__(func, **kwargs) + class SDODistance(SpatialFunction): "Class for Distance queries." sql_template = ('%(function)s(%(geo_col)s, %(geometry)s, %(tolerance)s) ' @@ -39,6 +40,7 @@ def __init__(self, op, tolerance=0.05): tolerance=tolerance, operator=op, result='%s') + class SDODWithin(SpatialFunction): dwithin_func = 'SDO_WITHIN_DISTANCE' sql_template = "%(function)s(%(geo_col)s, %(geometry)s, %%s) = 'TRUE'" @@ -46,6 +48,7 @@ class SDODWithin(SpatialFunction): def __init__(self): super(SDODWithin, self).__init__(self.dwithin_func) + class SDOGeomRelate(SpatialFunction): "Class for using SDO_GEOM.RELATE." relate_func = 'SDO_GEOM.RELATE' @@ -58,6 +61,7 @@ def __init__(self, mask, tolerance=0.05): super(SDOGeomRelate, self).__init__(self.relate_func, operator='=', mask=mask, tolerance=tolerance) + class SDORelate(SpatialFunction): "Class for using SDO_RELATE." masks = 'TOUCH|OVERLAPBDYDISJOINT|OVERLAPBDYINTERSECT|EQUAL|INSIDE|COVEREDBY|CONTAINS|COVERS|ANYINTERACT|ON' @@ -73,6 +77,7 @@ def __init__(self, mask): # Valid distance types and substitutions dtypes = (Decimal, Distance, float) + six.integer_types + class OracleOperations(DatabaseOperations, BaseSpatialOperations): compiler_module = "django.contrib.gis.db.backends.oracle.compiler" diff --git a/django/contrib/gis/db/backends/postgis/adapter.py b/django/contrib/gis/db/backends/postgis/adapter.py index 8bb514d760b6d..172133693bee3 100644 --- a/django/contrib/gis/db/backends/postgis/adapter.py +++ b/django/contrib/gis/db/backends/postgis/adapter.py @@ -6,6 +6,7 @@ from psycopg2 import Binary from psycopg2.extensions import ISQLQuote + class PostGISAdapter(object): def __init__(self, geom): "Initializes on the geometry." diff --git a/django/contrib/gis/db/backends/postgis/introspection.py b/django/contrib/gis/db/backends/postgis/introspection.py index d9e1dd350ec4d..8edc13387d536 100644 --- a/django/contrib/gis/db/backends/postgis/introspection.py +++ b/django/contrib/gis/db/backends/postgis/introspection.py @@ -1,9 +1,11 @@ from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection from django.contrib.gis.gdal import OGRGeomType + class GeoIntrospectionError(Exception): pass + class PostGISIntrospection(DatabaseIntrospection): # Reverse dictionary for PostGIS geometry types not populated until # introspection is actually performed. diff --git a/django/contrib/gis/db/backends/postgis/models.py b/django/contrib/gis/db/backends/postgis/models.py index e8052594c65ad..058d440b50da6 100644 --- a/django/contrib/gis/db/backends/postgis/models.py +++ b/django/contrib/gis/db/backends/postgis/models.py @@ -5,6 +5,7 @@ from django.contrib.gis.db.backends.base import SpatialRefSysMixin from django.utils.encoding import python_2_unicode_compatible + @python_2_unicode_compatible class GeometryColumns(models.Model): """ @@ -44,6 +45,7 @@ def __str__(self): (self.f_table_name, self.f_geometry_column, self.coord_dimension, self.type, self.srid) + class SpatialRefSys(models.Model, SpatialRefSysMixin): """ The 'spatial_ref_sys' table from PostGIS. See the PostGIS diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index 92e5323d36fa5..eae08479dff3f 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -22,15 +22,18 @@ class PostGISOperator(SpatialOperation): def __init__(self, operator): super(PostGISOperator, self).__init__(operator=operator) + class PostGISFunction(SpatialFunction): "For PostGIS function calls (e.g., `ST_Contains(table, geom)`)." def __init__(self, prefix, function, **kwargs): super(PostGISFunction, self).__init__(prefix + function, **kwargs) + class PostGISFunctionParam(PostGISFunction): "For PostGIS functions that take another parameter (e.g. DWithin, Relate)." sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)' + class PostGISDistance(PostGISFunction): "For PostGIS distance operations." dist_func = 'Distance' @@ -40,6 +43,7 @@ def __init__(self, prefix, operator): super(PostGISDistance, self).__init__(prefix, self.dist_func, operator=operator) + class PostGISSpheroidDistance(PostGISFunction): "For PostGIS spherical distance operations (using the spheroid)." dist_func = 'distance_spheroid' @@ -50,10 +54,12 @@ def __init__(self, prefix, operator): super(PostGISSpheroidDistance, self).__init__(prefix, self.dist_func, operator=operator) + class PostGISSphereDistance(PostGISDistance): "For PostGIS spherical distance operations." dist_func = 'distance_sphere' + class PostGISRelate(PostGISFunctionParam): "For PostGIS Relate(, ) calls." pattern_regex = re.compile(r'^[012TF\*]{9}$') diff --git a/django/contrib/gis/db/backends/spatialite/adapter.py b/django/contrib/gis/db/backends/spatialite/adapter.py index d8fefbadd862a..8a5c2d88bf907 100644 --- a/django/contrib/gis/db/backends/spatialite/adapter.py +++ b/django/contrib/gis/db/backends/spatialite/adapter.py @@ -1,6 +1,7 @@ from django.db.backends.sqlite3.base import Database from django.contrib.gis.db.backends.adapter import WKTAdapter + class SpatiaLiteAdapter(WKTAdapter): "SQLite adaptor for geometry objects." def __conform__(self, protocol): diff --git a/django/contrib/gis/db/backends/spatialite/base.py b/django/contrib/gis/db/backends/spatialite/base.py index 7b49d71a619f1..2efc2741064a4 100644 --- a/django/contrib/gis/db/backends/spatialite/base.py +++ b/django/contrib/gis/db/backends/spatialite/base.py @@ -11,6 +11,7 @@ from django.contrib.gis.db.backends.spatialite.operations import SpatiaLiteOperations from django.utils import six + class DatabaseWrapper(SQLiteDatabaseWrapper): def __init__(self, *args, **kwargs): # Before we get too far, make sure pysqlite 2.5+ is installed. diff --git a/django/contrib/gis/db/backends/spatialite/client.py b/django/contrib/gis/db/backends/spatialite/client.py index f9684877c5d15..c9dfd1a52758c 100644 --- a/django/contrib/gis/db/backends/spatialite/client.py +++ b/django/contrib/gis/db/backends/spatialite/client.py @@ -1,4 +1,5 @@ from django.db.backends.sqlite3.client import DatabaseClient + class SpatiaLiteClient(DatabaseClient): executable_name = 'spatialite' diff --git a/django/contrib/gis/db/backends/spatialite/introspection.py b/django/contrib/gis/db/backends/spatialite/introspection.py index c841d1ae6a91d..9e1616c514af0 100644 --- a/django/contrib/gis/db/backends/spatialite/introspection.py +++ b/django/contrib/gis/db/backends/spatialite/introspection.py @@ -2,6 +2,7 @@ from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict from django.utils import six + class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): """ Sublcass that includes updates the `base_data_types_reverse` dict @@ -18,6 +19,7 @@ class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): 'geometrycollection': 'GeometryField', }) + class SpatiaLiteIntrospection(DatabaseIntrospection): data_types_reverse = GeoFlexibleFieldLookupDict() diff --git a/django/contrib/gis/db/backends/spatialite/models.py b/django/contrib/gis/db/backends/spatialite/models.py index b281f0bc62b42..9860779647f0e 100644 --- a/django/contrib/gis/db/backends/spatialite/models.py +++ b/django/contrib/gis/db/backends/spatialite/models.py @@ -5,6 +5,7 @@ from django.contrib.gis.db.backends.base import SpatialRefSysMixin from django.utils.encoding import python_2_unicode_compatible + @python_2_unicode_compatible class GeometryColumns(models.Model): """ @@ -42,6 +43,7 @@ def __str__(self): (self.f_table_name, self.f_geometry_column, self.coord_dimension, self.type, self.srid) + class SpatialRefSys(models.Model, SpatialRefSysMixin): """ The 'spatial_ref_sys' table from SpatiaLite. diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py index 4954ba5210d5b..8d8435f8242cc 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -19,15 +19,18 @@ class SpatiaLiteOperator(SpatialOperation): def __init__(self, operator): super(SpatiaLiteOperator, self).__init__(operator=operator) + class SpatiaLiteFunction(SpatialFunction): "For SpatiaLite function calls." def __init__(self, function, **kwargs): super(SpatiaLiteFunction, self).__init__(function, **kwargs) + class SpatiaLiteFunctionParam(SpatiaLiteFunction): "For SpatiaLite functions that take another parameter." sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)' + class SpatiaLiteDistance(SpatiaLiteFunction): "For SpatiaLite distance operations." dist_func = 'Distance' @@ -37,6 +40,7 @@ def __init__(self, operator): super(SpatiaLiteDistance, self).__init__(self.dist_func, operator=operator) + class SpatiaLiteRelate(SpatiaLiteFunctionParam): "For SpatiaLite Relate(, ) calls." pattern_regex = re.compile(r'^[012TF\*]{9}$') @@ -46,12 +50,14 @@ def __init__(self, pattern): raise ValueError('Invalid intersection matrix pattern "%s".' % pattern) super(SpatiaLiteRelate, self).__init__('Relate') + # Valid distance types and substitutions dtypes = (Decimal, Distance, float) + six.integer_types def get_dist_ops(operator): "Returns operations for regular distances; spherical distances are not currently supported." return (SpatiaLiteDistance(operator),) + class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): compiler_module = 'django.contrib.gis.db.models.sql.compiler' name = 'spatialite' diff --git a/django/contrib/gis/db/backends/utils.py b/django/contrib/gis/db/backends/utils.py index 53f1e1b6a4020..b8b5b9525f1e3 100644 --- a/django/contrib/gis/db/backends/utils.py +++ b/django/contrib/gis/db/backends/utils.py @@ -3,6 +3,7 @@ backends. """ + class SpatialOperation(object): """ Base class for generating spatial SQL. @@ -28,6 +29,7 @@ def params(self, geo_col, geometry): params.update(self.extra) return params + class SpatialFunction(SpatialOperation): """ Base class for generating spatial SQL related to a function. diff --git a/django/contrib/gis/db/models/aggregates.py b/django/contrib/gis/db/models/aggregates.py index d0fc6d319d324..fbfabe0a1de45 100644 --- a/django/contrib/gis/db/models/aggregates.py +++ b/django/contrib/gis/db/models/aggregates.py @@ -1,16 +1,21 @@ from django.db.models import Aggregate + class Collect(Aggregate): name = 'Collect' + class Extent(Aggregate): name = 'Extent' + class Extent3D(Aggregate): name = 'Extent3D' + class MakeLine(Aggregate): name = 'MakeLine' + class Union(Aggregate): name = 'Union' diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py index e137ddffb5301..662b20ae79a19 100644 --- a/django/contrib/gis/db/models/fields.py +++ b/django/contrib/gis/db/models/fields.py @@ -11,6 +11,7 @@ # for SRID info each time a distance query is constructed. _srid_cache = {} + def get_srid_info(srid, connection): """ Returns the units, unit name, and spheroid WKT associated with the @@ -39,6 +40,7 @@ def get_srid_info(srid, connection): return _srid_cache[connection.alias][srid] + class GeometryField(Field): "The base GIS field -- maps to the OpenGIS Specification Geometry type." @@ -269,37 +271,44 @@ def get_placeholder(self, value, connection): """ return connection.ops.get_geom_placeholder(self, value) + # The OpenGIS Geometry Type Fields class PointField(GeometryField): geom_type = 'POINT' form_class = forms.PointField description = _("Point") + class LineStringField(GeometryField): geom_type = 'LINESTRING' form_class = forms.LineStringField description = _("Line string") + class PolygonField(GeometryField): geom_type = 'POLYGON' form_class = forms.PolygonField description = _("Polygon") + class MultiPointField(GeometryField): geom_type = 'MULTIPOINT' form_class = forms.MultiPointField description = _("Multi-point") + class MultiLineStringField(GeometryField): geom_type = 'MULTILINESTRING' form_class = forms.MultiLineStringField description = _("Multi-line string") + class MultiPolygonField(GeometryField): geom_type = 'MULTIPOLYGON' form_class = forms.MultiPolygonField description = _("Multi polygon") + class GeometryCollectionField(GeometryField): geom_type = 'GEOMETRYCOLLECTION' form_class = forms.GeometryCollectionField diff --git a/django/contrib/gis/db/models/manager.py b/django/contrib/gis/db/models/manager.py index aa57e3a5077ba..bbcbb579fa3c6 100644 --- a/django/contrib/gis/db/models/manager.py +++ b/django/contrib/gis/db/models/manager.py @@ -1,6 +1,7 @@ from django.db.models.manager import Manager from django.contrib.gis.db.models.query import GeoQuerySet + class GeoManager(Manager): "Overrides Manager to return Geographic QuerySets." diff --git a/django/contrib/gis/db/models/proxy.py b/django/contrib/gis/db/models/proxy.py index 513bf921bd818..91ded31dc014a 100644 --- a/django/contrib/gis/db/models/proxy.py +++ b/django/contrib/gis/db/models/proxy.py @@ -8,6 +8,7 @@ from django.contrib.gis import memoryview from django.utils import six + class GeometryProxy(object): def __init__(self, klass, field): """ diff --git a/django/contrib/gis/db/models/query.py b/django/contrib/gis/db/models/query.py index 2d13cbecc06d1..5f1d4623ab642 100644 --- a/django/contrib/gis/db/models/query.py +++ b/django/contrib/gis/db/models/query.py @@ -782,6 +782,7 @@ def _geocol_select(self, geo_field, field_name): else: return self.query.get_compiler(self.db)._field_column(geo_field) + class GeoValuesQuerySet(ValuesQuerySet): def __init__(self, *args, **kwargs): super(GeoValuesQuerySet, self).__init__(*args, **kwargs) @@ -790,5 +791,6 @@ def __init__(self, *args, **kwargs): # of string values are returned with `values()` or `values_list()`. self.query.geo_values = True + class GeoValuesListQuerySet(GeoValuesQuerySet, ValuesListQuerySet): pass diff --git a/django/contrib/gis/db/models/sql/aggregates.py b/django/contrib/gis/db/models/sql/aggregates.py index a3a8f1258dd68..07c3ddd2e5966 100644 --- a/django/contrib/gis/db/models/sql/aggregates.py +++ b/django/contrib/gis/db/models/sql/aggregates.py @@ -1,6 +1,7 @@ from django.db.models.sql.aggregates import * from django.contrib.gis.db.models.fields import GeometryField + class GeoAggregate(Aggregate): # Default SQL template for spatial aggregates. sql_template = '%(function)s(%(field)s)' @@ -46,17 +47,22 @@ def as_sql(self, qn, connection): return sql_template % substitutions, params + class Collect(GeoAggregate): pass + class Extent(GeoAggregate): is_extent = '2D' + class Extent3D(GeoAggregate): is_extent = '3D' + class MakeLine(GeoAggregate): pass + class Union(GeoAggregate): pass diff --git a/django/contrib/gis/db/models/sql/compiler.py b/django/contrib/gis/db/models/sql/compiler.py index 4cf52207f3f70..21fb57a417065 100644 --- a/django/contrib/gis/db/models/sql/compiler.py +++ b/django/contrib/gis/db/models/sql/compiler.py @@ -10,6 +10,7 @@ SQLCompiler = compiler.SQLCompiler + class GeoSQLCompiler(compiler.SQLCompiler): def get_columns(self, with_aliases=False): @@ -249,18 +250,23 @@ def _field_column(self, field, table_alias=None, column=None): return "%s.%s" % (self.quote_name_unless_alias(table_alias), self.connection.ops.quote_name(column or field.column)) + class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler): pass + class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler): pass + class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler): pass + class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler): pass + class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler): """ This is overridden for GeoDjango to properly cast date columns, since @@ -286,6 +292,7 @@ def results_iter(self): date = date.date() yield date + class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, GeoSQLCompiler): """ This is overridden for GeoDjango to properly cast date columns, since diff --git a/django/contrib/gis/db/models/sql/conversion.py b/django/contrib/gis/db/models/sql/conversion.py index 7f1b914baa46e..ee4f0e9e33fa0 100644 --- a/django/contrib/gis/db/models/sql/conversion.py +++ b/django/contrib/gis/db/models/sql/conversion.py @@ -3,6 +3,7 @@ to convert geospatial values from the database. """ + class BaseField(object): empty_strings_allowed = True @@ -10,16 +11,19 @@ def get_internal_type(self): "Overloaded method so OracleQuery.convert_values doesn't balk." return None + class AreaField(BaseField): "Wrapper for Area values." def __init__(self, area_att): self.area_att = area_att + class DistanceField(BaseField): "Wrapper for Distance values." def __init__(self, distance_att): self.distance_att = distance_att + class GeomField(BaseField): """ Wrapper for Geometry values. It is a lightweight alternative to diff --git a/django/contrib/gis/db/models/sql/query.py b/django/contrib/gis/db/models/sql/query.py index b789174525474..3923bf460e8d7 100644 --- a/django/contrib/gis/db/models/sql/query.py +++ b/django/contrib/gis/db/models/sql/query.py @@ -21,6 +21,7 @@ ]) ALL_TERMS.update(sql.constants.QUERY_TERMS) + class GeoQuery(sql.Query): """ A single spatial SQL query. diff --git a/django/contrib/gis/db/models/sql/where.py b/django/contrib/gis/db/models/sql/where.py index 7a9e098b912c1..3a504274b6b43 100644 --- a/django/contrib/gis/db/models/sql/where.py +++ b/django/contrib/gis/db/models/sql/where.py @@ -4,6 +4,7 @@ from django.db.models.sql.where import Constraint, WhereNode from django.contrib.gis.db.models.fields import GeometryField + class GeoConstraint(Constraint): """ This subclass overrides `process` to better handle geographic SQL @@ -27,6 +28,7 @@ def process(self, lookup_type, value, connection): params = self.field.get_db_prep_lookup(lookup_type, value, connection=connection) return (self.alias, self.col, db_type), params + class GeoWhereNode(WhereNode): """ Used to represent the SQL where-clause for spatial databases -- diff --git a/django/contrib/gis/feeds.py b/django/contrib/gis/feeds.py index 1482064fe25df..7e7b872df6c8e 100644 --- a/django/contrib/gis/feeds.py +++ b/django/contrib/gis/feeds.py @@ -3,6 +3,7 @@ from django.contrib.syndication.views import Feed as BaseFeed from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed + class GeoFeedMixin(object): """ This mixin provides the necessary routines for SyndicationFeed subclasses @@ -79,6 +80,7 @@ def add_georss_element(self, handler, item, w3c_geo=False): else: raise ValueError('Geometry type "%s" not supported.' % geom.geom_type) + ### SyndicationFeed subclasses ### class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin): def rss_attributes(self): @@ -94,6 +96,7 @@ def add_root_elements(self, handler): super(GeoRSSFeed, self).add_root_elements(handler) self.add_georss_element(handler, self.feed) + class GeoAtom1Feed(Atom1Feed, GeoFeedMixin): def root_attributes(self): attrs = super(GeoAtom1Feed, self).root_attributes() @@ -108,6 +111,7 @@ def add_root_elements(self, handler): super(GeoAtom1Feed, self).add_root_elements(handler) self.add_georss_element(handler, self.feed) + class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin): def rss_attributes(self): attrs = super(W3CGeoFeed, self).rss_attributes() @@ -122,6 +126,7 @@ def add_root_elements(self, handler): super(W3CGeoFeed, self).add_root_elements(handler) self.add_georss_element(handler, self.feed, w3c_geo=True) + ### Feed subclass ### class Feed(BaseFeed): """ diff --git a/django/contrib/gis/gdal/base.py b/django/contrib/gis/gdal/base.py index ac9b8c0a2a97e..74058104969e1 100644 --- a/django/contrib/gis/gdal/base.py +++ b/django/contrib/gis/gdal/base.py @@ -3,6 +3,7 @@ from django.contrib.gis.gdal.error import GDALException from django.utils import six + class GDALBase(object): """ Base object for GDAL objects that has a pointer access property diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py index 0d7f78a7357e6..864f50af5276b 100644 --- a/django/contrib/gis/gdal/datasource.py +++ b/django/contrib/gis/gdal/datasource.py @@ -49,6 +49,7 @@ from django.utils import six from django.utils.six.moves import xrange + # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html # diff --git a/django/contrib/gis/gdal/driver.py b/django/contrib/gis/gdal/driver.py index 015785b8d1861..58f736b1a30b3 100644 --- a/django/contrib/gis/gdal/driver.py +++ b/django/contrib/gis/gdal/driver.py @@ -7,6 +7,7 @@ from django.utils import six from django.utils.encoding import force_bytes + # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html # diff --git a/django/contrib/gis/gdal/envelope.py b/django/contrib/gis/gdal/envelope.py index 9774f686e7082..30da4a7c82db5 100644 --- a/django/contrib/gis/gdal/envelope.py +++ b/django/contrib/gis/gdal/envelope.py @@ -13,6 +13,7 @@ from ctypes import Structure, c_double from django.contrib.gis.gdal.error import OGRException + # The OGR definition of an Envelope is a C structure containing four doubles. # See the 'ogr_core.h' source file for more information: # http://www.gdal.org/ogr/ogr__core_8h-source.html @@ -24,6 +25,7 @@ class OGREnvelope(Structure): ("MaxY", c_double), ] + class Envelope(object): """ The Envelope object is a C structure that contains the minimum and diff --git a/django/contrib/gis/gdal/error.py b/django/contrib/gis/gdal/error.py index 968b7f74aa7e7..5feef4187328c 100644 --- a/django/contrib/gis/gdal/error.py +++ b/django/contrib/gis/gdal/error.py @@ -3,16 +3,20 @@ check_err() routine which checks the status code returned by OGR methods. """ + #### OGR & SRS Exceptions #### class GDALException(Exception): pass + class OGRException(Exception): pass + class SRSException(Exception): pass + class OGRIndexError(OGRException, KeyError): """ This exception is raised when an invalid index is encountered, and has @@ -37,6 +41,7 @@ class OGRIndexError(OGRException, KeyError): } OGRERR_NONE = 0 + def check_err(code): "Checks the given OGRERR, and raises an exception where appropriate." diff --git a/django/contrib/gis/gdal/feature.py b/django/contrib/gis/gdal/feature.py index a664be1598f62..d020b344884d6 100644 --- a/django/contrib/gis/gdal/feature.py +++ b/django/contrib/gis/gdal/feature.py @@ -11,6 +11,7 @@ from django.utils import six from django.utils.six.moves import xrange + # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html # diff --git a/django/contrib/gis/gdal/field.py b/django/contrib/gis/gdal/field.py index 7c46226ad6347..dd60f3b953467 100644 --- a/django/contrib/gis/gdal/field.py +++ b/django/contrib/gis/gdal/field.py @@ -102,6 +102,7 @@ def width(self): "Returns the width of this Field." return capi.get_field_width(self.ptr) + ### The Field sub-classes for each OGR Field type. ### class OFTInteger(Field): _double = False @@ -125,22 +126,27 @@ def type(self): """ return 0 + class OFTReal(Field): @property def value(self): "Returns a float contained in this field." return self.as_double() + # String & Binary fields, just subclasses class OFTString(Field): pass + class OFTWideString(Field): pass + class OFTBinary(Field): pass + # OFTDate, OFTTime, OFTDateTime fields. class OFTDate(Field): @property @@ -152,6 +158,7 @@ def value(self): except (ValueError, OGRException): return None + class OFTDateTime(Field): @property def value(self): @@ -166,6 +173,7 @@ def value(self): except (ValueError, OGRException): return None + class OFTTime(Field): @property def value(self): @@ -176,16 +184,20 @@ def value(self): except (ValueError, OGRException): return None + # List fields are also just subclasses class OFTIntegerList(Field): pass + class OFTRealList(Field): pass + class OFTStringList(Field): pass + class OFTWideStringList(Field): pass diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index 74a4e94450aa7..98ae5a1108c88 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -67,7 +67,7 @@ # # The OGR_G_* routines are relevant here. -#### OGRGeometry Class #### + class OGRGeometry(GDALBase): "Generally encapsulates an OGR geometry." diff --git a/django/contrib/gis/gdal/layer.py b/django/contrib/gis/gdal/layer.py index 226013540c24c..1fe5f52fb5d86 100644 --- a/django/contrib/gis/gdal/layer.py +++ b/django/contrib/gis/gdal/layer.py @@ -18,6 +18,7 @@ from django.utils import six from django.utils.six.moves import xrange + # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html # diff --git a/django/contrib/gis/gdal/srs.py b/django/contrib/gis/gdal/srs.py index 0e5767967aaa7..2c05bfb9434e2 100644 --- a/django/contrib/gis/gdal/srs.py +++ b/django/contrib/gis/gdal/srs.py @@ -328,6 +328,7 @@ def xml(self, dialect=''): "Returns the XML representation of this Spatial Reference." return capi.to_xml(self.ptr, byref(c_char_p()), dialect) + class CoordTransform(GDALBase): "The coordinate system transformation object." diff --git a/django/contrib/gis/geoip/base.py b/django/contrib/gis/geoip/base.py index c4188d8819822..05e3b5c2686e4 100644 --- a/django/contrib/gis/geoip/base.py +++ b/django/contrib/gis/geoip/base.py @@ -17,10 +17,12 @@ free_regex = re.compile(r'^GEO-\d{3}FREE') lite_regex = re.compile(r'^GEO-\d{3}LITE') + #### GeoIP classes #### class GeoIPException(Exception): pass + class GeoIP(object): # The flags for GeoIP memory caching. # GEOIP_STANDARD - read database from filesystem, uses least memory. diff --git a/django/contrib/gis/geos/base.py b/django/contrib/gis/geos/base.py index 1d44e0a8b6223..ff54fe669557d 100644 --- a/django/contrib/gis/geos/base.py +++ b/django/contrib/gis/geos/base.py @@ -18,6 +18,7 @@ class GDALInfo(object): except ImportError: numpy = False + class GEOSBase(object): """ Base object for GEOS objects that has a pointer access property diff --git a/django/contrib/gis/geos/io.py b/django/contrib/gis/geos/io.py index 1c13d365f702c..97c4016865c7b 100644 --- a/django/contrib/gis/geos/io.py +++ b/django/contrib/gis/geos/io.py @@ -6,12 +6,14 @@ from django.contrib.gis.geos.geometry import GEOSGeometry from django.contrib.gis.geos.prototypes.io import _WKTReader, _WKBReader, WKBWriter, WKTWriter + # Public classes for (WKB|WKT)Reader, which return GEOSGeometry class WKBReader(_WKBReader): def read(self, wkb): "Returns a GEOSGeometry for the given WKB buffer." return GEOSGeometry(super(WKBReader, self).read(wkb)) + class WKTReader(_WKTReader): def read(self, wkt): "Returns a GEOSGeometry for the given WKT string." diff --git a/django/contrib/gis/geos/mutable_list.py b/django/contrib/gis/geos/mutable_list.py index 87ae6dd8f3478..08ebb0a8e7c56 100644 --- a/django/contrib/gis/geos/mutable_list.py +++ b/django/contrib/gis/geos/mutable_list.py @@ -12,6 +12,7 @@ from django.utils import six from django.utils.six.moves import xrange + @total_ordering class ListMixin(object): """ diff --git a/django/contrib/gis/geos/polygon.py b/django/contrib/gis/geos/polygon.py index 0da90e3a19d74..ef8eb27de5284 100644 --- a/django/contrib/gis/geos/polygon.py +++ b/django/contrib/gis/geos/polygon.py @@ -6,6 +6,7 @@ from django.utils import six from django.utils.six.moves import xrange + class Polygon(GEOSGeometry): _minlength = 1 diff --git a/django/contrib/gis/geos/prepared.py b/django/contrib/gis/geos/prepared.py index d414d8ddf6840..a6a205da5eef0 100644 --- a/django/contrib/gis/geos/prepared.py +++ b/django/contrib/gis/geos/prepared.py @@ -2,6 +2,7 @@ from django.contrib.gis.geos.geometry import GEOSGeometry from django.contrib.gis.geos.prototypes import prepared as capi + class PreparedGeometry(GEOSBase): """ A geometry that is prepared for performing certain operations. diff --git a/django/contrib/gis/measure.py b/django/contrib/gis/measure.py index 82d75e0cefda2..0343211495801 100644 --- a/django/contrib/gis/measure.py +++ b/django/contrib/gis/measure.py @@ -44,6 +44,7 @@ NUMERIC_TYPES = six.integer_types + (float, Decimal) AREA_PREFIX = "sq_" + def pretty_name(obj): return obj.__name__ if obj.__class__ == type else obj.__class__.__name__ @@ -218,6 +219,7 @@ def unit_attname(cls, unit_str): else: raise Exception('Could not find a unit keyword associated with "%s"' % unit_str) + class Distance(MeasureBase): STANDARD_UNIT = "m" UNITS = { diff --git a/django/contrib/gis/shortcuts.py b/django/contrib/gis/shortcuts.py index 85f9bfd0c0301..a530228e84787 100644 --- a/django/contrib/gis/shortcuts.py +++ b/django/contrib/gis/shortcuts.py @@ -5,6 +5,7 @@ from django.http import HttpResponse from django.template import loader + def compress_kml(kml): "Returns compressed KMZ from the given KML string." kmz = BytesIO() @@ -14,11 +15,13 @@ def compress_kml(kml): kmz.seek(0) return kmz.read() + def render_to_kml(*args, **kwargs): "Renders the response as KML (using the correct MIME type)." return HttpResponse(loader.render_to_string(*args, **kwargs), content_type='application/vnd.google-earth.kml+xml') + def render_to_kmz(*args, **kwargs): """ Compresses the KML content and returns as KMZ (using the correct @@ -27,6 +30,7 @@ def render_to_kmz(*args, **kwargs): return HttpResponse(compress_kml(loader.render_to_string(*args, **kwargs)), content_type='application/vnd.google-earth.kmz') + def render_to_text(*args, **kwargs): "Renders the response using the MIME type for plain text." return HttpResponse(loader.render_to_string(*args, **kwargs), diff --git a/django/contrib/gis/sitemaps/georss.py b/django/contrib/gis/sitemaps/georss.py index 5201de913b949..effa06f98e9c9 100644 --- a/django/contrib/gis/sitemaps/georss.py +++ b/django/contrib/gis/sitemaps/georss.py @@ -1,6 +1,7 @@ from django.core import urlresolvers from django.contrib.sitemaps import Sitemap + class GeoRSSSitemap(Sitemap): """ A minimal hook to produce sitemaps for GeoRSS feeds. diff --git a/django/contrib/gis/sitemaps/kml.py b/django/contrib/gis/sitemaps/kml.py index 68e2ffd7d95af..5e74c6c47dc0c 100644 --- a/django/contrib/gis/sitemaps/kml.py +++ b/django/contrib/gis/sitemaps/kml.py @@ -3,6 +3,7 @@ from django.contrib.gis.db.models.fields import GeometryField from django.db import models + class KMLSitemap(Sitemap): """ A minimal hook to produce KML sitemaps. @@ -60,5 +61,7 @@ def location(self, obj): 'field_name': obj[2], } ) + + class KMZSitemap(KMLSitemap): geo_format = 'kmz' diff --git a/django/contrib/gis/sitemaps/views.py b/django/contrib/gis/sitemaps/views.py index dac63658e6e7c..5dc3bc9273e18 100644 --- a/django/contrib/gis/sitemaps/views.py +++ b/django/contrib/gis/sitemaps/views.py @@ -14,6 +14,7 @@ from django.contrib.gis.shortcuts import render_to_kml, render_to_kmz + def index(request, sitemaps): """ This view generates a sitemap index that uses the proper view diff --git a/django/contrib/gis/tests/test_measure.py b/django/contrib/gis/tests/test_measure.py index 5e0db3f913111..58a1af0bf1182 100644 --- a/django/contrib/gis/tests/test_measure.py +++ b/django/contrib/gis/tests/test_measure.py @@ -144,6 +144,7 @@ def testUnitAttName(self): for nm, att in unit_tuple: self.assertEqual(att, D.unit_attname(nm)) + class AreaTest(unittest.TestCase): "Testing the Area object" diff --git a/django/contrib/gis/tests/utils.py b/django/contrib/gis/tests/utils.py index e6433e648907f..a53b9a3564957 100644 --- a/django/contrib/gis/tests/utils.py +++ b/django/contrib/gis/tests/utils.py @@ -14,17 +14,21 @@ def inner(): else: return test_func + # Decorators to disable entire test functions for specific # spatial backends. def no_oracle(func): return no_backend(func, 'oracle') + def no_postgis(func): return no_backend(func, 'postgis') + def no_mysql(func): return no_backend(func, 'mysql') + def no_spatialite(func): return no_backend(func, 'spatialite') diff --git a/django/contrib/gis/views.py b/django/contrib/gis/views.py index 3fa8f044dedb8..cc6844ba4897a 100644 --- a/django/contrib/gis/views.py +++ b/django/contrib/gis/views.py @@ -3,6 +3,7 @@ from django.http import Http404 from django.utils.translation import ugettext as _ + def feed(request, url, feed_dict=None): """Provided for backwards compatibility.""" if not feed_dict: diff --git a/django/contrib/sites/management.py b/django/contrib/sites/management.py index a4a0090dab3a7..7dec568fa4bc9 100644 --- a/django/contrib/sites/management.py +++ b/django/contrib/sites/management.py @@ -9,6 +9,7 @@ from django.contrib.sites import models as site_app from django.core.management.color import no_style + def create_default_site(app, created_models, verbosity, db, **kwargs): # Only create the default sites in databases where Django created the table if Site in created_models and router.allow_migrate(db, Site): diff --git a/django/contrib/staticfiles/handlers.py b/django/contrib/staticfiles/handlers.py index e036f6b141a24..3fe0c9da26b2c 100644 --- a/django/contrib/staticfiles/handlers.py +++ b/django/contrib/staticfiles/handlers.py @@ -6,6 +6,7 @@ from django.contrib.staticfiles import utils from django.contrib.staticfiles.views import serve + class StaticFilesHandler(WSGIHandler): """ WSGI middleware that intercepts calls to the static files directory, as diff --git a/django/contrib/staticfiles/urls.py b/django/contrib/staticfiles/urls.py index 04062c1162b5a..4a0feeaaf8c00 100644 --- a/django/contrib/staticfiles/urls.py +++ b/django/contrib/staticfiles/urls.py @@ -3,6 +3,7 @@ urlpatterns = [] + def staticfiles_urlpatterns(prefix=None): """ Helper function to return a URL pattern for serving static files.