mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 01:26:53 +03:00
Fixed various typos (#4366)
This commit is contained in:
parent
febaa4db00
commit
e1768bdc16
|
@ -168,7 +168,7 @@ except ImportError:
|
|||
crispy_forms = None
|
||||
|
||||
|
||||
# coreapi is optional (Note that uritemplate is a dependancy of coreapi)
|
||||
# coreapi is optional (Note that uritemplate is a dependency of coreapi)
|
||||
try:
|
||||
import coreapi
|
||||
import uritemplate
|
||||
|
|
|
@ -395,8 +395,8 @@ class Field(object):
|
|||
# determine if we should use null instead.
|
||||
return '' if getattr(self, 'allow_blank', False) else None
|
||||
elif ret == '' and not self.required:
|
||||
# If the field is blank, and emptyness is valid then
|
||||
# determine if we should use emptyness instead.
|
||||
# If the field is blank, and emptiness is valid then
|
||||
# determine if we should use emptiness instead.
|
||||
return '' if getattr(self, 'allow_blank', False) else empty
|
||||
return ret
|
||||
return dictionary.get(self.field_name, empty)
|
||||
|
@ -1346,7 +1346,7 @@ class FilePathField(ChoiceField):
|
|||
|
||||
def __init__(self, path, match=None, recursive=False, allow_files=True,
|
||||
allow_folders=False, required=None, **kwargs):
|
||||
# Defer to Django's FilePathField implmentation to get the
|
||||
# Defer to Django's FilePathField implementation to get the
|
||||
# valid set of choices.
|
||||
field = DjangoFilePathField(
|
||||
path, match=match, recursive=recursive, allow_files=allow_files,
|
||||
|
|
|
@ -90,7 +90,7 @@ class DefaultContentNegotiation(BaseContentNegotiation):
|
|||
|
||||
def get_accept_list(self, request):
|
||||
"""
|
||||
Given the incoming request, return a tokenised list of media
|
||||
Given the incoming request, return a tokenized list of media
|
||||
type strings.
|
||||
"""
|
||||
header = request.META.get('HTTP_ACCEPT', '*/*')
|
||||
|
|
|
@ -64,10 +64,10 @@ def _get_displayed_page_numbers(current, final):
|
|||
|
||||
This implementation gives one page to each side of the cursor,
|
||||
or two pages to the side when the cursor is at the edge, then
|
||||
ensures that any breaks between non-continous page numbers never
|
||||
ensures that any breaks between non-continuous page numbers never
|
||||
remove only a single page.
|
||||
|
||||
For an alernativative implementation which gives two pages to each side of
|
||||
For an alternative implementation which gives two pages to each side of
|
||||
the cursor, eg. as in GitHub issue list pagination, see:
|
||||
|
||||
https://gist.github.com/tomchristie/321140cebb1c4a558b15
|
||||
|
@ -476,10 +476,10 @@ class CursorPagination(BasePagination):
|
|||
|
||||
# Determine the position of the final item following the page.
|
||||
if len(results) > len(self.page):
|
||||
has_following_postion = True
|
||||
has_following_position = True
|
||||
following_position = self._get_position_from_instance(results[-1], self.ordering)
|
||||
else:
|
||||
has_following_postion = False
|
||||
has_following_position = False
|
||||
following_position = None
|
||||
|
||||
# If we have a reverse queryset, then the query ordering was in reverse
|
||||
|
@ -490,14 +490,14 @@ class CursorPagination(BasePagination):
|
|||
if reverse:
|
||||
# Determine next and previous positions for reverse cursors.
|
||||
self.has_next = (current_position is not None) or (offset > 0)
|
||||
self.has_previous = has_following_postion
|
||||
self.has_previous = has_following_position
|
||||
if self.has_next:
|
||||
self.next_position = current_position
|
||||
if self.has_previous:
|
||||
self.previous_position = following_position
|
||||
else:
|
||||
# Determine next and previous positions for forward cursors.
|
||||
self.has_next = has_following_postion
|
||||
self.has_next = has_following_position
|
||||
self.has_previous = (current_position is not None) or (offset > 0)
|
||||
if self.has_next:
|
||||
self.next_position = following_position
|
||||
|
@ -534,7 +534,7 @@ class CursorPagination(BasePagination):
|
|||
# our marker.
|
||||
break
|
||||
|
||||
# The item in this postion has the same position as the item
|
||||
# The item in this position has the same position as the item
|
||||
# following it, we can't use it as a marker position, so increment
|
||||
# the offset and keep seeking to the previous item.
|
||||
compare = position
|
||||
|
@ -582,7 +582,7 @@ class CursorPagination(BasePagination):
|
|||
# our marker.
|
||||
break
|
||||
|
||||
# The item in this postion has the same position as the item
|
||||
# The item in this position has the same position as the item
|
||||
# following it, we can't use it as a marker position, so increment
|
||||
# the offset and keep seeking to the previous item.
|
||||
compare = position
|
||||
|
|
|
@ -1383,7 +1383,7 @@ class ModelSerializer(Serializer):
|
|||
|
||||
def get_unique_together_validators(self):
|
||||
"""
|
||||
Determine a default set of validators for any unique_together contraints.
|
||||
Determine a default set of validators for any unique_together constraints.
|
||||
"""
|
||||
model_class_inheritance_tree = (
|
||||
[self.Meta.model] +
|
||||
|
@ -1414,7 +1414,7 @@ class ModelSerializer(Serializer):
|
|||
|
||||
def get_unique_for_date_validators(self):
|
||||
"""
|
||||
Determine a default set of validators for the following contraints:
|
||||
Determine a default set of validators for the following constraints:
|
||||
|
||||
* unique_for_date
|
||||
* unique_for_month
|
||||
|
|
|
@ -189,7 +189,7 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru
|
|||
leading punctuation (opening parens) and it'll still do the right thing.
|
||||
|
||||
If trim_url_limit is not None, the URLs in link text longer than this limit
|
||||
will truncated to trim_url_limit-3 characters and appended with an elipsis.
|
||||
will truncated to trim_url_limit-3 characters and appended with an ellipsis.
|
||||
|
||||
If nofollow is True, the URLs in link text will get a rel="nofollow"
|
||||
attribute.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
Helper functions for mapping model fields to a dictionary of default
|
||||
keyword arguments that should be used for their equivelent serializer fields.
|
||||
keyword arguments that should be used for their equivalent serializer fields.
|
||||
"""
|
||||
import inspect
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ def is_html_input(dictionary):
|
|||
|
||||
def parse_html_list(dictionary, prefix=''):
|
||||
"""
|
||||
Used to suport list values in HTML forms.
|
||||
Used to support list values in HTML forms.
|
||||
Supports lists of primitives and/or dictionaries.
|
||||
|
||||
* List of primitives.
|
||||
|
|
|
@ -94,7 +94,7 @@ class NamespaceVersioning(BaseVersioning):
|
|||
The difference is in the backend - this implementation uses
|
||||
Django's URL namespaces to determine the version.
|
||||
|
||||
An example URL conf that is namespaced into two seperate versions
|
||||
An example URL conf that is namespaced into two separate versions
|
||||
|
||||
# users/urls.py
|
||||
urlpatterns = [
|
||||
|
@ -147,7 +147,7 @@ class HostNameVersioning(BaseVersioning):
|
|||
invalid_version_message = _('Invalid version in hostname.')
|
||||
|
||||
def determine_version(self, request, *args, **kwargs):
|
||||
hostname, seperator, port = request.get_host().partition(':')
|
||||
hostname, separator, port = request.get_host().partition(':')
|
||||
match = self.hostname_regex.match(hostname)
|
||||
if not match:
|
||||
return self.default_version
|
||||
|
|
|
@ -112,7 +112,7 @@ class ViewSetMixin(object):
|
|||
if method == 'options':
|
||||
# This is a special case as we always provide handling for the
|
||||
# options method in the base `View` class.
|
||||
# Unlike the other explicitly defined actions, 'metadata' is implict.
|
||||
# Unlike the other explicitly defined actions, 'metadata' is implicit.
|
||||
self.action = 'metadata'
|
||||
else:
|
||||
self.action = self.action_map.get(method)
|
||||
|
|
|
@ -440,7 +440,7 @@ class FailingAuthAccessedInRenderer(TestCase):
|
|||
class NoAuthenticationClassesTests(TestCase):
|
||||
def test_permission_message_with_no_authentication_classes(self):
|
||||
"""
|
||||
An unauthenticated request made against a view that containes no
|
||||
An unauthenticated request made against a view that contains no
|
||||
`authentication_classes` but do contain `permissions_classes` the error
|
||||
code returned should be 403 with the exception's message.
|
||||
"""
|
||||
|
|
|
@ -974,7 +974,7 @@ class TestDateField(FieldValues):
|
|||
|
||||
class TestCustomInputFormatDateField(FieldValues):
|
||||
"""
|
||||
Valid and invalid values for `DateField` with a cutom input format.
|
||||
Valid and invalid values for `DateField` with a custom input format.
|
||||
"""
|
||||
valid_inputs = {
|
||||
'1 Jan 2001': datetime.date(2001, 1, 1),
|
||||
|
@ -1041,7 +1041,7 @@ class TestDateTimeField(FieldValues):
|
|||
|
||||
class TestCustomInputFormatDateTimeField(FieldValues):
|
||||
"""
|
||||
Valid and invalid values for `DateTimeField` with a cutom input format.
|
||||
Valid and invalid values for `DateTimeField` with a custom input format.
|
||||
"""
|
||||
valid_inputs = {
|
||||
'1:35pm, 1 Jan 2001': datetime.datetime(2001, 1, 1, 13, 35, tzinfo=timezone.UTC()),
|
||||
|
|
|
@ -711,7 +711,7 @@ class OrderingFilterTests(TestCase):
|
|||
serializer_class = OrderingFilterSerializer
|
||||
filter_backends = (filters.OrderingFilter,)
|
||||
ordering = ('title',)
|
||||
oredering_fields = ('text',)
|
||||
ordering_fields = ('text',)
|
||||
|
||||
view = OrderingListView.as_view()
|
||||
request = factory.get('')
|
||||
|
@ -819,7 +819,7 @@ class OrderingFilterTests(TestCase):
|
|||
queryset = OrderingFilterModel.objects.all()
|
||||
filter_backends = (filters.OrderingFilter,)
|
||||
ordering = ('title',)
|
||||
# note: no ordering_fields and serializer_class speficied
|
||||
# note: no ordering_fields and serializer_class specified
|
||||
|
||||
def get_serializer_class(self):
|
||||
return OrderingFilterSerializer
|
||||
|
@ -842,7 +842,7 @@ class OrderingFilterTests(TestCase):
|
|||
filter_backends = (filters.OrderingFilter,)
|
||||
ordering = ('title',)
|
||||
# note: no ordering_fields and serializer_class
|
||||
# or get_serializer_class speficied
|
||||
# or get_serializer_class specified
|
||||
|
||||
view = OrderingListView.as_view()
|
||||
request = factory.get('/', {'ordering': 'text'})
|
||||
|
|
|
@ -136,7 +136,7 @@ class TestModelSerializer(TestCase):
|
|||
class TestRegularFieldMappings(TestCase):
|
||||
def test_regular_fields(self):
|
||||
"""
|
||||
Model fields should map to their equivelent serializer fields.
|
||||
Model fields should map to their equivalent serializer fields.
|
||||
"""
|
||||
class TestSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
|
@ -67,8 +67,8 @@ class TestPaginationIntegration:
|
|||
|
||||
def test_setting_page_size_over_maximum(self):
|
||||
"""
|
||||
When page_size parameter exceeds maxiumum allowable,
|
||||
then it should be capped to the maxiumum.
|
||||
When page_size parameter exceeds maximum allowable,
|
||||
then it should be capped to the maximum.
|
||||
"""
|
||||
request = factory.get('/', {'page_size': 1000})
|
||||
response = self.view(request)
|
||||
|
@ -259,7 +259,7 @@ class TestPageNumberPaginationOverride:
|
|||
|
||||
def setup(self):
|
||||
class OverriddenDjangoPaginator(DjangoPaginator):
|
||||
# override the count in our overriden Django Paginator
|
||||
# override the count in our overridden Django Paginator
|
||||
# we will only return one page, with one item
|
||||
count = 1
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ factory = APIRequestFactory()
|
|||
|
||||
class TemplateTagTests(TestCase):
|
||||
|
||||
def test_add_query_param_with_non_latin_charactor(self):
|
||||
def test_add_query_param_with_non_latin_character(self):
|
||||
# Ensure we don't double-escape non-latin characters
|
||||
# that are present in the querystring.
|
||||
# See #1314.
|
||||
|
|
|
@ -78,7 +78,7 @@ class TestAPITestClient(TestCase):
|
|||
response = self.client.get('/session-view/')
|
||||
self.assertEqual(response.data['active_session'], False)
|
||||
|
||||
# Subsequant requests have an active session
|
||||
# Subsequent requests have an active session
|
||||
response = self.client.get('/session-view/')
|
||||
self.assertEqual(response.data['active_session'], True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user