From 0c349410526bf02284f06c45988227132b034b03 Mon Sep 17 00:00:00 2001 From: Aleksander Petrushkin Date: Sun, 17 Sep 2023 02:19:25 +0300 Subject: [PATCH] Fix use method (#69) * fix use deprecated method * fix grammar error --------- Co-authored-by: aapetrushkin --- server/apps/identity/intrastructure/services/placeholder.py | 4 ++-- server/apps/identity/views/user.py | 2 +- server/apps/pictures/models.py | 2 +- server/apps/pictures/views.py | 6 +++--- .../common/django/templates/common/includes/messages.html | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/apps/identity/intrastructure/services/placeholder.py b/server/apps/identity/intrastructure/services/placeholder.py index 4944ef4e..bede3f75 100644 --- a/server/apps/identity/intrastructure/services/placeholder.py +++ b/server/apps/identity/intrastructure/services/placeholder.py @@ -17,7 +17,7 @@ class UserResponse(pydantic_model.BaseModel): # TODO: use redis-based caching @final class LeadCreate(http.BaseFetcher): - """Service around creating new users and fething their :term:`lead_id`.""" + """Service around creating new users and fetching their :term:`lead_id`.""" _url_path = '/users' @@ -33,7 +33,7 @@ def __call__( timeout=self._api_timeout, ) response.raise_for_status() - return UserResponse.parse_raw(response.text) + return UserResponse.model_validate_json(response.text) @final diff --git a/server/apps/identity/views/user.py b/server/apps/identity/views/user.py index add5b7ca..c4c19d16 100644 --- a/server/apps/identity/views/user.py +++ b/server/apps/identity/views/user.py @@ -31,7 +31,7 @@ class UserUpdateView(RatelimitMixin, UpdateView[User, UserUpdateForm]): ratelimit_key = 'ip' ratelimit_rate = '10/h' ratelimit_block = True - retelimit_method = ['POST', 'PUT'] # GET is safe + ratelimit_method = ['POST', 'PUT'] # GET is safe def get_object(self, queryset: QuerySet[User] | None = None) -> User: """We only work with the current user.""" diff --git a/server/apps/pictures/models.py b/server/apps/pictures/models.py index 50d4ee20..66aaa9e8 100644 --- a/server/apps/pictures/models.py +++ b/server/apps/pictures/models.py @@ -22,5 +22,5 @@ class FavouritePicture(TimedMixin, models.Model): url = models.URLField() def __str__(self) -> str: - """Beatuful representation.""" + """Beautiful representation.""" return ''.format(self.foreign_id, self.user_id) diff --git a/server/apps/pictures/views.py b/server/apps/pictures/views.py index a52a3b9f..c698fccb 100644 --- a/server/apps/pictures/views.py +++ b/server/apps/pictures/views.py @@ -40,11 +40,11 @@ class DashboardView(CreateView[FavouritePicture, FavouritesForm]): success_url = reverse_lazy('pictures:dashboard') def get_context_data(self, **kwargs: Any) -> dict[str, Any]: - """Innject extra context to template rendering.""" - fetch_puctures = container.instantiate(pictures_fetch.PicturesFetch) + """Inject extra context to template rendering.""" + fetch_pictures = container.instantiate(pictures_fetch.PicturesFetch) context = super().get_context_data(**kwargs) - context['pictures'] = fetch_puctures() # sync http call, may hang + context['pictures'] = fetch_pictures() # sync http call, may hang return context def get_form_kwargs(self) -> dict[str, Any]: diff --git a/server/common/django/templates/common/includes/messages.html b/server/common/django/templates/common/includes/messages.html index 7de6ef34..789614f3 100644 --- a/server/common/django/templates/common/includes/messages.html +++ b/server/common/django/templates/common/includes/messages.html @@ -1,6 +1,6 @@ {% if messages %} {% for message in messages %} - {# We don't have any non-succesful messages just yet #} + {# We don't have any non-successful messages just yet #}

{{ message }}

{% endfor %} {% endif %}