fix: fixed django4 warnings (#29644)

This commit is contained in:
Mohammad Ahtasham ul Hassan
2022-03-07 15:50:17 +05:00
committed by GitHub
parent 533b971d83
commit 68e0885ca8
11 changed files with 134 additions and 181 deletions

View File

@@ -33,6 +33,7 @@ class DeveloperErrorResponseException(Exception):
it does not need to be recreated when returning a response.
Intended to be used with and by DeveloperErrorViewMixin.
"""
def __init__(self, response):
super().__init__()
self.response = response
@@ -174,7 +175,7 @@ def build_api_error(message, **kwargs):
Args:
message (string): The string to use for developer and user messages.
The user message will be translated, but for this to work message
must have already been scraped. ugettext_noop is useful for this.
must have already been scraped. gettext_noop is useful for this.
**kwargs: format parameters for message
"""
return {
@@ -188,6 +189,7 @@ class RetrievePatchAPIView(RetrieveModelMixin, UpdateModelMixin, GenericAPIView)
Like DRF's RetrieveUpdateAPIView, but without PUT and with automatic validation errors in the edX format.
"""
def get(self, request, *args, **kwargs):
"""Retrieves the specified resource using the RetrieveModelMixin."""
return self.retrieve(request, *args, **kwargs)
@@ -245,6 +247,7 @@ class LazySequence(Sequence):
It is immutable, and accepts an estimated length in order to support __len__
without exhausting the underlying sequence
"""
def __init__(self, iterable, est_len=None):
self.iterable = iterable
self.est_len = est_len