Fixed typos in docs, comments, and exception messages.

This commit is contained in:
Ville Skyttä 2019-04-14 10:44:56 +03:00 committed by Mariusz Felisiak
parent 177fa08339
commit 03db5fddfd
13 changed files with 22 additions and 21 deletions

View File

@ -110,7 +110,7 @@ class Command(BaseCommand):
app_list_value = app_list.setdefault(app_config, []) 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 # this app (no model qualifier was given). In this case
# there is no need adding specific models to the list. # there is no need adding specific models to the list.
if app_list_value is not None: if app_list_value is not None:

View File

@ -146,19 +146,19 @@ class Serializer:
""" """
Called to handle each individual (non-relational) field on an object. 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): def handle_fk_field(self, obj, field):
""" """
Called to handle a ForeignKey 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): def handle_m2m_field(self, obj, field):
""" """
Called to handle a ManyToManyField. 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): def getvalue(self):
""" """

View File

@ -394,7 +394,7 @@ class BaseDatabaseOperations:
to tables with foreign keys pointing the tables being truncated. to tables with foreign keys pointing the tables being truncated.
PostgreSQL requires a cascade even if these tables are empty. 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): def execute_sql_flush(self, using, sql_list):
"""Execute a list of SQL statements to flush the database.""" """Execute a list of SQL statements to flush the database."""

View File

@ -18,7 +18,7 @@ class ModelTuple(namedtuple('ModelTupleBase', ('app_label', 'model_name'))):
@classmethod @classmethod
def from_model(cls, model, app_label=None, model_name=None): 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 ModelTuple('app_label', 'modelname'). The optional app_label and
model_name arguments are the defaults if "self" or "ModelName" are model_name arguments are the defaults if "self" or "ModelName" are
passed. passed.

View File

@ -727,7 +727,7 @@ class Model(metaclass=ModelBase):
% ', '.join(non_model_fields)) % ', '.join(non_model_fields))
# If saving to the same database, and this model is deferred, then # 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: elif not force_insert and deferred_fields and using == self._state.db:
field_names = set() field_names = set()
for field in self._meta.concrete_fields: for field in self._meta.concrete_fields:

View File

@ -189,7 +189,7 @@ class BaseForm:
return '%s-%s' % (self.prefix, field_name) if self.prefix else field_name return '%s-%s' % (self.prefix, field_name) if self.prefix else field_name
def add_initial_prefix(self, 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) 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): def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row):

View File

@ -1172,9 +1172,9 @@ blue.
The name of the GDAL driver used to handle the input file. For ``GDALRaster``\s created 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 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 scratch is an in-memory raster by default (``'MEM'``), but can be
needed. For instance, use ``GTiff`` for a ``GeoTiff`` file. For a list of file types, altered as needed. For instance, use ``GTiff`` for a ``GeoTiff`` file.
see also the `GDAL Raster Formats`__ list. For a list of file types, see also the `GDAL Raster Formats`__ list.
__ https://www.gdal.org/formats_list.html __ https://www.gdal.org/formats_list.html
@ -1271,9 +1271,9 @@ blue.
.. attribute:: scale .. attribute:: scale
Pixel width and height used for georeferencing the raster, as a as a Pixel width and height used for georeferencing the raster, as a point
point object with ``x`` and ``y`` members. See :attr:`geotransform` object with ``x`` and ``y`` members. See :attr:`geotransform` for more
for more information. information.
>>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326}) >>> rst = GDALRaster({'width': 10, 'height': 20, 'srid': 4326})
>>> rst.scale >>> rst.scale

View File

@ -132,7 +132,7 @@ following methods:
prominent example is ``__year`` that transforms a ``DateField`` into a prominent example is ``__year`` that transforms a ``DateField`` into a
``IntegerField``. ``IntegerField``.
The notation to use a ``Transform`` in an lookup expression is The notation to use a ``Transform`` in a lookup expression is
``<expression>__<transformation>`` (e.g. ``date__year``). ``<expression>__<transformation>`` (e.g. ``date__year``).
This class follows the :ref:`Query Expression API <query-expression>`, which This class follows the :ref:`Query Expression API <query-expression>`, which

View File

@ -1737,7 +1737,8 @@ raised if ``select_for_update()`` is used in autocommit mode.
Takes a raw SQL query, executes it, and returns a Takes a raw SQL query, executes it, and returns a
``django.db.models.query.RawQuerySet`` instance. This ``RawQuerySet`` instance ``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. See the :doc:`/topics/db/sql` for more information.

View File

@ -628,7 +628,7 @@ below.
Also, you can give :class:`RequestContext` a list of additional processors, Also, you can give :class:`RequestContext` a list of additional processors,
using the optional, third positional argument, ``processors``. In this 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.http import HttpResponse
from django.template import RequestContext, Template from django.template import RequestContext, Template

View File

@ -134,7 +134,7 @@ extensibility and customization in mind.
Practically, this means you'll need to rewrite all of your ``class Admin`` 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 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 some more details on how to rewrite that ``Admin`` declaration into the new
syntax. syntax.

View File

@ -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 development server continues to serve the admin files just like before. Read
the :doc:`static files howto </howto/static-files/index>` for more details. the :doc:`static files howto </howto/static-files/index>` 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 ``http://media.example.com/admin/``), make sure to also set your
:setting:`STATIC_URL` setting to the correct URL -- for example, :setting:`STATIC_URL` setting to the correct URL -- for example,
``http://media.example.com/``. ``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`. * 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 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 pre-upgrade Django instance and try to submit it to the upgraded Django
instance: instance:

View File

@ -37,7 +37,7 @@ class SimpleDatabaseOperationTests(SimpleTestCase):
self.assertEqual(self.ops.set_time_zone_sql(), '') self.assertEqual(self.ops.set_time_zone_sql(), '')
def test_sql_flush(self): 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): with self.assertRaisesMessage(NotImplementedError, msg):
self.ops.sql_flush(None, None, None) self.ops.sql_flush(None, None, None)