mirror of
https://github.com/suitenumerique/drive.git
synced 2026-08-17 20:15:40 +02:00
🎨(backend) assign the quota with a walrus operator
Apply a review suggestion to keep the quota lookup and its guard on a single line in the entitlements endpoint.
This commit is contained in:
@@ -2468,8 +2468,7 @@ class EntitlementsViewset(viewsets.ViewSet):
|
|||||||
method = getattr(entitlements_backend, method_name)
|
method = getattr(entitlements_backend, method_name)
|
||||||
if callable(method):
|
if callable(method):
|
||||||
entitlements[method_name] = method(request.user)
|
entitlements[method_name] = method(request.user)
|
||||||
quota = entitlements_backend.get_quota(request.user)
|
if quota := entitlements_backend.get_quota(request.user):
|
||||||
if quota:
|
|
||||||
entitlements["quota"] = quota
|
entitlements["quota"] = quota
|
||||||
entitlements["context"] = entitlements_backend.get_context(request.user)
|
entitlements["context"] = entitlements_backend.get_context(request.user)
|
||||||
return drf.response.Response(entitlements)
|
return drf.response.Response(entitlements)
|
||||||
|
|||||||
Reference in New Issue
Block a user