From 03db5fddfd0c76303ec83eb1cd91a6d2dc4441cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 14 Apr 2019 10:44:56 +0300 Subject: [PATCH] Fixed typos in docs, comments, and exception messages. --- django/core/management/commands/dumpdata.py | 2 +- django/core/serializers/base.py | 6 +++--- django/db/backends/base/operations.py | 2 +- django/db/migrations/operations/utils.py | 2 +- django/db/models/base.py | 2 +- django/forms/forms.py | 2 +- docs/ref/contrib/gis/gdal.txt | 12 ++++++------ docs/ref/models/lookups.txt | 2 +- docs/ref/models/querysets.txt | 3 ++- docs/ref/templates/api.txt | 2 +- docs/releases/1.0-porting-guide.txt | 2 +- docs/releases/1.4.txt | 4 ++-- tests/backends/base/test_operations.py | 2 +- 13 files changed, 22 insertions(+), 21 deletions(-) diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py index ce936c5459..2968f74805 100644 --- a/django/core/management/commands/dumpdata.py +++ b/django/core/management/commands/dumpdata.py @@ -110,7 +110,7 @@ class Command(BaseCommand): app_list_value = app_list.setdefault(app_config, []) - # We may have previously seen a "all-models" request for + # We may have previously seen an "all-models" request for # this app (no model qualifier was given). In this case # there is no need adding specific models to the list. if app_list_value is not None: diff --git a/django/core/serializers/base.py b/django/core/serializers/base.py index a9c6dbf1dc..4fa95f6f6e 100644 --- a/django/core/serializers/base.py +++ b/django/core/serializers/base.py @@ -146,19 +146,19 @@ class Serializer: """ Called to handle each individual (non-relational) field on an object. """ - raise NotImplementedError('subclasses of Serializer must provide an handle_field() method') + raise NotImplementedError('subclasses of Serializer must provide a handle_field() method') def handle_fk_field(self, obj, field): """ Called to handle a ForeignKey field. """ - raise NotImplementedError('subclasses of Serializer must provide an handle_fk_field() method') + raise NotImplementedError('subclasses of Serializer must provide a handle_fk_field() method') def handle_m2m_field(self, obj, field): """ Called to handle a ManyToManyField. """ - raise NotImplementedError('subclasses of Serializer must provide an handle_m2m_field() method') + raise NotImplementedError('subclasses of Serializer must provide a handle_m2m_field() method') def getvalue(self): """ diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py index 892527873a..b7e35760cb 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -394,7 +394,7 @@ class BaseDatabaseOperations: to tables with foreign keys pointing the tables being truncated. PostgreSQL requires a cascade even if these tables are empty. """ - raise NotImplementedError('subclasses of BaseDatabaseOperations must provide an sql_flush() method') + raise NotImplementedError('subclasses of BaseDatabaseOperations must provide a sql_flush() method') def execute_sql_flush(self, using, sql_list): """Execute a list of SQL statements to flush the database.""" diff --git a/django/db/migrations/operations/utils.py b/django/db/migrations/operations/utils.py index 34fdaba821..adb2a7febb 100644 --- a/django/db/migrations/operations/utils.py +++ b/django/db/migrations/operations/utils.py @@ -18,7 +18,7 @@ class ModelTuple(namedtuple('ModelTupleBase', ('app_label', 'model_name'))): @classmethod def from_model(cls, model, app_label=None, model_name=None): """ - Take a model class or a 'app_label.ModelName' string and return a + Take a model class or an 'app_label.ModelName' string and return a ModelTuple('app_label', 'modelname'). The optional app_label and model_name arguments are the defaults if "self" or "ModelName" are passed. diff --git a/django/db/models/base.py b/django/db/models/base.py index f2560117d2..0a1120322e 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -727,7 +727,7 @@ class Model(metaclass=ModelBase): % ', '.join(non_model_fields)) # If saving to the same database, and this model is deferred, then - # automatically do a "update_fields" save on the loaded fields. + # automatically do an "update_fields" save on the loaded fields. elif not force_insert and deferred_fields and using == self._state.db: field_names = set() for field in self._meta.concrete_fields: diff --git a/django/forms/forms.py b/django/forms/forms.py index 3898419ab2..0ab25643da 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -189,7 +189,7 @@ class BaseForm: return '%s-%s' % (self.prefix, field_name) if self.prefix else field_name def add_initial_prefix(self, field_name): - """Add a 'initial' prefix for checking dynamic initial values.""" + """Add an 'initial' prefix for checking dynamic initial values.""" return 'initial-%s' % self.add_prefix(field_name) def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row): diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index c1860a204d..6dde659e2d 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -1172,9 +1172,9 @@ blue. The name of the GDAL driver used to handle the input file. For ``GDALRaster``\s created from a file, the driver type is detected automatically. The creation of rasters from - scratch is a in-memory raster by default (``'MEM'``), but can be altered as - needed. For instance, use ``GTiff`` for a ``GeoTiff`` file. For a list of file types, - see also the `GDAL Raster Formats`__ list. + scratch is an in-memory raster by default (``'MEM'``), but can be + altered as needed. For instance, use ``GTiff`` for a ``GeoTiff`` file. + For a list of file types, see also the `GDAL Raster Formats`__ list. __ https://www.gdal.org/formats_list.html @@ -1271,9 +1271,9 @@ blue. .. attribute:: scale - Pixel width and height used for georeferencing the raster, as a as a - point object with ``x`` and ``y`` members. See :attr:`geotransform` - for more information. + Pixel width and height used for georeferencing the raster, as a point + object with ``x`` and ``y`` members. See :attr:`geotransform` for more + information. >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326}) >>> rst.scale diff --git a/docs/ref/models/lookups.txt b/docs/ref/models/lookups.txt index c0e97e9fe6..aae5ba96c4 100644 --- a/docs/ref/models/lookups.txt +++ b/docs/ref/models/lookups.txt @@ -132,7 +132,7 @@ following methods: prominent example is ``__year`` that transforms a ``DateField`` into a ``IntegerField``. - The notation to use a ``Transform`` in an lookup expression is + The notation to use a ``Transform`` in a lookup expression is ``__`` (e.g. ``date__year``). This class follows the :ref:`Query Expression API `, which diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 8485d436e1..6428576cbc 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1737,7 +1737,8 @@ raised if ``select_for_update()`` is used in autocommit mode. Takes a raw SQL query, executes it, and returns a ``django.db.models.query.RawQuerySet`` instance. This ``RawQuerySet`` instance -can be iterated over just like an normal ``QuerySet`` to provide object instances. +can be iterated over just like a normal ``QuerySet`` to provide object +instances. See the :doc:`/topics/db/sql` for more information. diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt index 86ef097749..dbd8324ba2 100644 --- a/docs/ref/templates/api.txt +++ b/docs/ref/templates/api.txt @@ -628,7 +628,7 @@ below. Also, you can give :class:`RequestContext` a list of additional processors, using the optional, third positional argument, ``processors``. In this -example, the :class:`RequestContext` instance gets a ``ip_address`` variable:: +example, the :class:`RequestContext` instance gets an ``ip_address`` variable:: from django.http import HttpResponse from django.template import RequestContext, Template diff --git a/docs/releases/1.0-porting-guide.txt b/docs/releases/1.0-porting-guide.txt index 7f96f5e80f..8ea7945ad3 100644 --- a/docs/releases/1.0-porting-guide.txt +++ b/docs/releases/1.0-porting-guide.txt @@ -134,7 +134,7 @@ extensibility and customization in mind. Practically, this means you'll need to rewrite all of your ``class Admin`` declarations. You've already seen in `models`_ above how to replace your ``class -Admin`` with a ``admin.site.register()`` call in an ``admin.py`` file. Below are +Admin`` with an ``admin.site.register()`` call in an ``admin.py`` file. Below are some more details on how to rewrite that ``Admin`` declaration into the new syntax. diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt index 8bf30b77e5..ccee3df153 100644 --- a/docs/releases/1.4.txt +++ b/docs/releases/1.4.txt @@ -699,7 +699,7 @@ are configured and your Web server serves those files correctly. The development server continues to serve the admin files just like before. Read the :doc:`static files howto ` for more details. -If your ``ADMIN_MEDIA_PREFIX`` is set to an specific domain (e.g. +If your ``ADMIN_MEDIA_PREFIX`` is set to a specific domain (e.g. ``http://media.example.com/admin/``), make sure to also set your :setting:`STATIC_URL` setting to the correct URL -- for example, ``http://media.example.com/``. @@ -783,7 +783,7 @@ time you need to run Django 1.3 for the data to expire or become irrelevant. * Time period: Defined by :setting:`PASSWORD_RESET_TIMEOUT_DAYS`. -Form-related hashes: these have a are much shorter lifetime and are relevant +Form-related hashes: these have a much shorter lifetime and are relevant only for the short window where a user might fill in a form generated by the pre-upgrade Django instance and try to submit it to the upgraded Django instance: diff --git a/tests/backends/base/test_operations.py b/tests/backends/base/test_operations.py index 607afb6dfc..021043a834 100644 --- a/tests/backends/base/test_operations.py +++ b/tests/backends/base/test_operations.py @@ -37,7 +37,7 @@ class SimpleDatabaseOperationTests(SimpleTestCase): self.assertEqual(self.ops.set_time_zone_sql(), '') def test_sql_flush(self): - msg = 'subclasses of BaseDatabaseOperations must provide an sql_flush() method' + msg = 'subclasses of BaseDatabaseOperations must provide a sql_flush() method' with self.assertRaisesMessage(NotImplementedError, msg): self.ops.sql_flush(None, None, None)