🎨(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:
Nathan Vasse
2026-07-23 17:08:11 +02:00
parent 060707c037
commit 826ad05ce6
+1 -2
View File
@@ -2468,8 +2468,7 @@ class EntitlementsViewset(viewsets.ViewSet):
method = getattr(entitlements_backend, method_name)
if callable(method):
entitlements[method_name] = method(request.user)
quota = entitlements_backend.get_quota(request.user)
if quota:
if quota := entitlements_backend.get_quota(request.user):
entitlements["quota"] = quota
entitlements["context"] = entitlements_backend.get_context(request.user)
return drf.response.Response(entitlements)