Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

rest: Remove kwargs from rest_path.

Zixuan James Lieb88fee745c6
diff --git a/zerver/lib/rest.py b/zerver/lib/rest.py
index be9f25806c3..14db988222c 100644
--- a/zerver/lib/rest.py
+++ b/zerver/lib/rest.py
@@ -1,5 +1,5 @@
from functools import wraps
-from typing import Any, Callable, Dict, Mapping, Set, Tuple, Union, cast
+from typing import Any, Callable, Dict, Set, Tuple, Union, cast
from django.http import HttpRequest, HttpResponse
from django.urls import path
@@ -199,7 +199,6 @@ def rest_dispatch(request: HttpRequest, **kwargs: Any) -> HttpResponse:
def rest_path(
route: str,
- kwargs: Mapping[str, object] = {},
**handlers: Union[Callable[..., HttpResponse], Tuple[Callable[..., HttpResponse], Set[str]]],
) -> URLPattern:
- return path(route, rest_dispatch, {**kwargs, **handlers})
+ return path(route, rest_dispatch, handlers)
diff --git a/zerver/views/users.py b/zerver/views/users.py
index 4d07b491732..178743bcb8b 100644
--- a/zerver/views/users.py
+++ b/zerver/views/users.py
@@ -324,6 +324,12 @@ def avatar(
return redirect(url)
+def avatar_medium(
+ request: HttpRequest, maybe_user_profile: Union[UserProfile, AnonymousUser], email_or_id: str
+) -> HttpResponse:
+ return avatar(request, maybe_user_profile, email_or_id, medium=True)
+
+
def get_stream_name(stream: Optional[Stream]) -> Optional[str]:
if stream:
return stream.name
diff --git a/zproject/urls.py b/zproject/urls.py
index 9959eca7cb8..7afc9c52bd0 100644
--- a/zproject/urls.py
+++ b/zproject/urls.py
@@ -195,6 +195,7 @@ from zerver.views.user_settings import (
from zerver.views.users import (
add_bot_backend,
avatar,
+ avatar_medium,
create_user_backend,
deactivate_bot_backend,
deactivate_user_backend,
@@ -725,8 +726,10 @@ urls += [
),
rest_path(
"avatar/<email_or_id>/medium",
- {"medium": True},
- GET=(avatar, {"override_api_url_scheme", "allow_anonymous_user_web"}),
+ GET=(
+ avatar_medium,
+ {"override_api_url_scheme", "allow_anonymous_user_web"},
+ ),
),
]