Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Fix use method (#69)
Browse files Browse the repository at this point in the history
* fix use deprecated method

* fix grammar error

---------

Co-authored-by: aapetrushkin <[email protected]>
  • Loading branch information
Hazzari and aapetrushkin authored Sep 16, 2023
1 parent 3144a56 commit 0c34941
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions server/apps/identity/intrastructure/services/placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/apps/identity/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion server/apps/pictures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ class FavouritePicture(TimedMixin, models.Model):
url = models.URLField()

def __str__(self) -> str:
"""Beatuful representation."""
"""Beautiful representation."""
return '<Picture {0} by {1}>'.format(self.foreign_id, self.user_id)
6 changes: 3 additions & 3 deletions server/apps/pictures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
Original file line number Diff line number Diff line change
@@ -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 #}
<p>{{ message }}</p>
{% endfor %}
{% endif %}

0 comments on commit 0c34941

Please sign in to comment.