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.

rate_limit: Remove domain arg to the rate_limit decorator.

Mateusz Mandera5e8e843613af
diff --git a/zerver/decorator.py b/zerver/decorator.py
index 663cb35051b..204c167048c 100644
--- a/zerver/decorator.py
+++ b/zerver/decorator.py
@@ -847,11 +847,8 @@ def rate_limit_user(request: HttpRequest, user: UserProfile, domain: str) -> Non
RateLimitedUser(user, domain=domain).rate_limit_request(request)
-def rate_limit(domain: str = "api_by_user") -> Callable[[ViewFuncT], ViewFuncT]:
- """Rate-limits a view. Takes an optional 'domain' param if you wish to
- rate limit different types of API calls independently.
-
- Returns a decorator"""
+def rate_limit() -> Callable[[ViewFuncT], ViewFuncT]:
+ """Rate-limits a view. Returns a decorator"""
def wrapper(func: ViewFuncT) -> ViewFuncT:
@wraps(func)
@@ -878,7 +875,7 @@ def rate_limit(domain: str = "api_by_user") -> Callable[[ViewFuncT], ViewFuncT]:
return func(request, *args, **kwargs)
assert isinstance(user, UserProfile)
- rate_limit_user(request, user, domain)
+ rate_limit_user(request, user, domain="api_by_user")
return func(request, *args, **kwargs)