Fixed #28776 -- Fixed a/an/and typos in docs and comments.

This commit is contained in:
Дилян Палаузов 2017-11-06 22:11:39 -05:00 committed by Tim Graham
parent 5587485d49
commit 6c0042430e
24 changed files with 29 additions and 29 deletions

View File

@ -50,7 +50,7 @@ def shortcut(request, content_type_id, object_id):
opts = obj._meta opts = obj._meta
# First, look for an many-to-many relationship to Site. # First, look for a many-to-many relationship to Site.
for field in opts.many_to_many: for field in opts.many_to_many:
if field.remote_field.model is Site: if field.remote_field.model is Site:
try: try:

View File

@ -204,7 +204,7 @@ class BaseStorageFinder(BaseFinder):
raise ImproperlyConfigured("The staticfiles storage finder %r " raise ImproperlyConfigured("The staticfiles storage finder %r "
"doesn't have a storage class " "doesn't have a storage class "
"assigned." % self.__class__) "assigned." % self.__class__)
# Make sure we have an storage instance here. # Make sure we have a storage instance here.
if not isinstance(self.storage, (Storage, LazyObject)): if not isinstance(self.storage, (Storage, LazyObject)):
self.storage = self.storage() self.storage = self.storage()
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

View File

@ -15,7 +15,7 @@ __all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',
class UploadedFile(File): class UploadedFile(File):
""" """
A abstract uploaded file (``TemporaryUploadedFile`` and An abstract uploaded file (``TemporaryUploadedFile`` and
``InMemoryUploadedFile`` are the built-in concrete subclasses). ``InMemoryUploadedFile`` are the built-in concrete subclasses).
An ``UploadedFile`` object behaves somewhat like a file object and An ``UploadedFile`` object behaves somewhat like a file object and

View File

@ -21,7 +21,7 @@ class EmailBackend(ConsoleEmailBackend):
if not isinstance(self.file_path, str): if not isinstance(self.file_path, str):
raise ImproperlyConfigured('Path for saving emails is invalid: %r' % self.file_path) raise ImproperlyConfigured('Path for saving emails is invalid: %r' % self.file_path)
self.file_path = os.path.abspath(self.file_path) self.file_path = os.path.abspath(self.file_path)
# Make sure that self.file_path is an directory if it exists. # Make sure that self.file_path is a directory if it exists.
if os.path.exists(self.file_path) and not os.path.isdir(self.file_path): if os.path.exists(self.file_path) and not os.path.isdir(self.file_path):
raise ImproperlyConfigured( raise ImproperlyConfigured(
'Path for saving email messages exists, but is not a directory: %s' % self.file_path 'Path for saving email messages exists, but is not a directory: %s' % self.file_path

View File

@ -72,7 +72,7 @@ class Command(BaseCommand):
self.loaddata(fixture_labels) self.loaddata(fixture_labels)
# Close the DB connection -- unless we're still in a transaction. This # Close the DB connection -- unless we're still in a transaction. This
# is required as a workaround for an edge case in MySQL: if the same # is required as a workaround for an edge case in MySQL: if the same
# connection is used to create tables, load data, and query, the query # connection is used to create tables, load data, and query, the query
# can return incorrect results. See Django #7572, MySQL #37735. # can return incorrect results. See Django #7572, MySQL #37735.
if transaction.get_autocommit(self.using): if transaction.get_autocommit(self.using):

View File

@ -63,7 +63,7 @@ class RelatedIn(In):
if isinstance(self.lhs, MultiColSource): if isinstance(self.lhs, MultiColSource):
# For multicolumn lookups we need to build a multicolumn where clause. # For multicolumn lookups we need to build a multicolumn where clause.
# This clause is either a SubqueryConstraint (for values that need to be compiled to # This clause is either a SubqueryConstraint (for values that need to be compiled to
# SQL) or a OR-combined list of (col1 = val1 AND col2 = val2 AND ...) clauses. # SQL) or an OR-combined list of (col1 = val1 AND col2 = val2 AND ...) clauses.
from django.db.models.sql.where import WhereNode, SubqueryConstraint, AND, OR from django.db.models.sql.where import WhereNode, SubqueryConstraint, AND, OR
root_constraint = WhereNode(connector=OR) root_constraint = WhereNode(connector=OR)

View File

@ -489,7 +489,7 @@ class JsonResponse(HttpResponse):
:param data: Data to be dumped into json. By default only ``dict`` objects :param data: Data to be dumped into json. By default only ``dict`` objects
are allowed to be passed due to a security flaw before EcmaScript 5. See are allowed to be passed due to a security flaw before EcmaScript 5. See
the ``safe`` parameter for more information. the ``safe`` parameter for more information.
:param encoder: Should be an json encoder class. Defaults to :param encoder: Should be a json encoder class. Defaults to
``django.core.serializers.json.DjangoJSONEncoder``. ``django.core.serializers.json.DjangoJSONEncoder``.
:param safe: Controls if only ``dict`` objects may be serialized. Defaults :param safe: Controls if only ``dict`` objects may be serialized. Defaults
to ``True``. to ``True``.

View File

@ -79,8 +79,8 @@ def get_object_or_404(klass, *args, **kwargs):
klass may be a Model, Manager, or QuerySet object. All other passed klass may be a Model, Manager, or QuerySet object. All other passed
arguments and keyword arguments are used in the get() query. arguments and keyword arguments are used in the get() query.
Note: Like with get(), an MultipleObjectsReturned will be raised if more than one Like with QuerySet.get(), MultipleObjectsReturned is raised if more than
object is found. one object is found.
""" """
queryset = _get_queryset(klass) queryset = _get_queryset(klass)
try: try:

View File

@ -159,7 +159,7 @@ class FormView(TemplateResponseMixin, BaseFormView):
class BaseCreateView(ModelFormMixin, ProcessFormView): class BaseCreateView(ModelFormMixin, ProcessFormView):
""" """
Base view for creating an new object instance. Base view for creating a new object instance.
Using this base class requires subclassing to provide a response mixin. Using this base class requires subclassing to provide a response mixin.
""" """

View File

@ -1862,7 +1862,7 @@ __ https://github.com/django/django/blob/master/django/utils/log.py
Default: ``'logging.config.dictConfig'`` Default: ``'logging.config.dictConfig'``
A path to a callable that will be used to configure logging in the A path to a callable that will be used to configure logging in the
Django project. Points at a instance of Python's :ref:`dictConfig Django project. Points at an instance of Python's :ref:`dictConfig
<logging-config-dictschema>` configuration method by default. <logging-config-dictschema>` configuration method by default.
If you set :setting:`LOGGING_CONFIG` to ``None``, the logging If you set :setting:`LOGGING_CONFIG` to ``None``, the logging

View File

@ -207,7 +207,7 @@ detail in :doc:`the ORM aggregation documentation </topics/db/aggregation>`.
Query expressions Query expressions
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Queries can now refer to a another field on the query and can traverse Queries can now refer to another field on the query and can traverse
relationships to refer to fields on related models. This is implemented in the relationships to refer to fields on related models. This is implemented in the
new :class:`~django.db.models.F` object; for full details, including examples, new :class:`~django.db.models.F` object; for full details, including examples,
consult the :class:`F expressions documentation <django.db.models.F>`. consult the :class:`F expressions documentation <django.db.models.F>`.

View File

@ -354,7 +354,7 @@ class SystemChecksTestCase(SimpleTestCase):
def test_generic_inline_model_admin_non_generic_model(self): def test_generic_inline_model_admin_non_generic_model(self):
""" """
A model without a GenericForeignKey raises problems if it's included A model without a GenericForeignKey raises problems if it's included
in an GenericInlineModelAdmin definition. in a GenericInlineModelAdmin definition.
""" """
class BookInline(GenericStackedInline): class BookInline(GenericStackedInline):
model = Book model = Book

View File

@ -57,8 +57,8 @@ class UserModelChecksTests(SimpleTestCase):
@override_settings(AUTH_USER_MODEL='auth_tests.CustomUserNonUniqueUsername') @override_settings(AUTH_USER_MODEL='auth_tests.CustomUserNonUniqueUsername')
def test_username_non_unique(self): def test_username_non_unique(self):
""" """
A non-unique USERNAME_FIELD should raise an error only if we use the A non-unique USERNAME_FIELD raises an error only if the default
default authentication backend. Otherwise, an warning should be raised. authentication backend is used. Otherwise, a warning is raised.
""" """
errors = checks.run_checks() errors = checks.run_checks()
self.assertEqual(errors, [ self.assertEqual(errors, [

View File

@ -244,7 +244,7 @@ class DimensionClosingBug(unittest.TestCase):
""" """
# We need to inject a modified open() builtin into the images module # We need to inject a modified open() builtin into the images module
# that checks if the file was closed properly if the function is # that checks if the file was closed properly if the function is
# called with a filename instead of an file object. # called with a filename instead of a file object.
# get_image_dimensions will call our catching_open instead of the # get_image_dimensions will call our catching_open instead of the
# regular builtin one. # regular builtin one.

View File

@ -40,7 +40,7 @@ class Group(models.Model):
return self.name return self.name
# A set of models that use an non-abstract inherited model as the 'through' model. # A set of models that use a non-abstract inherited model as the 'through' model.
class A(models.Model): class A(models.Model):
a_text = models.CharField(max_length=20) a_text = models.CharField(max_length=20)

View File

@ -65,7 +65,7 @@ class ManagersRegressionTests(TestCase):
AbstractBase3.objects.all() AbstractBase3.objects.all()
def test_custom_abstract_manager(self): def test_custom_abstract_manager(self):
# Accessing the manager on an abstract model with an custom # Accessing the manager on an abstract model with a custom
# manager should raise an attribute error with an appropriate # manager should raise an attribute error with an appropriate
# message. # message.
msg = "Manager isn't available; AbstractBase2 is abstract" msg = "Manager isn't available; AbstractBase2 is abstract"

View File

@ -570,12 +570,12 @@ class ManyToOneTests(TestCase):
Third.objects.create(name='Third 1') Third.objects.create(name='Third 1')
Third.objects.create(name='Third 2') Third.objects.create(name='Third 2')
th = Third(name="testing") th = Third(name="testing")
# The object isn't saved an thus the relation field is null - we won't even # The object isn't saved and thus the relation field is null - we won't even
# execute a query in this case. # execute a query in this case.
with self.assertNumQueries(0): with self.assertNumQueries(0):
self.assertEqual(th.child_set.count(), 0) self.assertEqual(th.child_set.count(), 0)
th.save() th.save()
# Now the model is saved, so we will need to execute an query. # Now the model is saved, so we will need to execute a query.
with self.assertNumQueries(1): with self.assertNumQueries(1):
self.assertEqual(th.child_set.count(), 0) self.assertEqual(th.child_set.count(), 0)
@ -591,7 +591,7 @@ class ManyToOneTests(TestCase):
self.assertEqual(public_student.school, public_school) self.assertEqual(public_student.school, public_school)
# Make sure the base manager is used so that an student can still access # Make sure the base manager is used so that a student can still access
# its related school even if the default manager doesn't normally # its related school even if the default manager doesn't normally
# allow it. # allow it.
self.assertEqual(private_student.school, private_school) self.assertEqual(private_student.school, private_school)

View File

@ -1146,7 +1146,7 @@ class AutodetectorTests(TestCase):
# a CreateModel operation w/o any definition on the original model # a CreateModel operation w/o any definition on the original model
model_state_not_specified = ModelState("a", "model", [("id", models.AutoField(primary_key=True))]) model_state_not_specified = ModelState("a", "model", [("id", models.AutoField(primary_key=True))])
# Explicitly testing for None, since this was the issue in #23452 after # Explicitly testing for None, since this was the issue in #23452 after
# a AlterFooTogether operation with e.g. () as value # an AlterFooTogether operation with e.g. () as value
model_state_none = ModelState("a", "model", [ model_state_none = ModelState("a", "model", [
("id", models.AutoField(primary_key=True)) ("id", models.AutoField(primary_key=True))
], { ], {

View File

@ -155,7 +155,7 @@ class MigrateTests(MigrationTestBase):
# Fails because "migrations_tribble" does not exist but needs to in # Fails because "migrations_tribble" does not exist but needs to in
# order to make --fake-initial work. # order to make --fake-initial work.
call_command("migrate", "migrations", fake_initial=True, verbosity=0) call_command("migrate", "migrations", fake_initial=True, verbosity=0)
# Fake a apply # Fake an apply
call_command("migrate", "migrations", fake=True, verbosity=0) call_command("migrate", "migrations", fake=True, verbosity=0)
call_command("migrate", "migrations", fake=True, verbosity=0, database="other") call_command("migrate", "migrations", fake=True, verbosity=0, database="other")
# Unmigrate everything # Unmigrate everything

View File

@ -188,7 +188,7 @@ class ModelTests(TestCase):
@skipUnlessDBFeature("supports_timezones") @skipUnlessDBFeature("supports_timezones")
def test_timezones(self): def test_timezones(self):
# Saving an updating with timezone-aware datetime Python objects. # Saving and updating with timezone-aware datetime Python objects.
# Regression test for #10443. # Regression test for #10443.
# The idea is that all these creations and saving should work without # The idea is that all these creations and saving should work without
# crashing. It's not rocket science. # crashing. It's not rocket science.

View File

@ -69,7 +69,7 @@ class ManagerMixin(models.Model):
class OtherPerson(Person, ManagerMixin): class OtherPerson(Person, ManagerMixin):
""" """
A class with the default manager from Person, plus an secondary manager. A class with the default manager from Person, plus a secondary manager.
""" """
class Meta: class Meta:
proxy = True proxy = True

View File

@ -235,7 +235,7 @@ class RequestsTests(SimpleTestCase):
self.assertEqual(response.cookies['c']['expires'], '') self.assertEqual(response.cookies['c']['expires'], '')
def test_far_expiration(self): def test_far_expiration(self):
"Cookie will expire when an distant expiration time is provided" "Cookie will expire when a distant expiration time is provided"
response = HttpResponse() response = HttpResponse()
response.set_cookie('datetime', expires=datetime(2028, 1, 1, 4, 5, 6)) response.set_cookie('datetime', expires=datetime(2028, 1, 1, 4, 5, 6))
datetime_cookie = response.cookies['datetime'] datetime_cookie = response.cookies['datetime']

View File

@ -1 +1 @@
not really a EOT ;) not really an EOT ;)

View File

@ -96,10 +96,10 @@ class TestHashedFiles:
def test_path_with_querystring_and_fragment(self): def test_path_with_querystring_and_fragment(self):
relpath = self.hashed_file_path("cached/css/fragments.css") relpath = self.hashed_file_path("cached/css/fragments.css")
self.assertEqual(relpath, "cached/css/fragments.c4e6753b52d3.css") self.assertEqual(relpath, "cached/css/fragments.a60c0e74834f.css")
with storage.staticfiles_storage.open(relpath) as relfile: with storage.staticfiles_storage.open(relpath) as relfile:
content = relfile.read() content = relfile.read()
self.assertIn(b'fonts/font.a4b0478549d0.eot?#iefix', content) self.assertIn(b'fonts/font.b9b105392eb8.eot?#iefix', content)
self.assertIn(b'fonts/font.b8d603e42714.svg#webfontIyfZbseF', content) self.assertIn(b'fonts/font.b8d603e42714.svg#webfontIyfZbseF', content)
self.assertIn(b'fonts/font.b8d603e42714.svg#path/to/../../fonts/font.svg', content) self.assertIn(b'fonts/font.b8d603e42714.svg#path/to/../../fonts/font.svg', content)
self.assertIn(b'data:font/woff;charset=utf-8;base64,d09GRgABAAAAADJoAA0AAAAAR2QAAQAAAAAAAAAAAAA', content) self.assertIn(b'data:font/woff;charset=utf-8;base64,d09GRgABAAAAADJoAA0AAAAAR2QAAQAAAAAAAAAAAAA', content)