Python formatting
This commit is contained in:
parent
e5c8500547
commit
191079a922
|
@ -47,7 +47,9 @@ urlpatterns = [
|
||||||
re_path(r"^ostatus_subscribe/?$", views.ostatus_follow_request),
|
re_path(r"^ostatus_subscribe/?$", views.ostatus_follow_request),
|
||||||
# polling updates
|
# polling updates
|
||||||
re_path("^api/updates/notifications/?$", views.get_notification_count),
|
re_path("^api/updates/notifications/?$", views.get_notification_count),
|
||||||
re_path("^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_string),
|
re_path(
|
||||||
|
"^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_string
|
||||||
|
),
|
||||||
# authentication
|
# authentication
|
||||||
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
||||||
re_path(r"^login/(?P<confirmed>confirmed)/?$", views.Login.as_view(), name="login"),
|
re_path(r"^login/(?P<confirmed>confirmed)/?$", views.Login.as_view(), name="login"),
|
||||||
|
|
|
@ -33,14 +33,14 @@ def get_unread_status_string(request, stream="home"):
|
||||||
allowed_status_types = request.user.feed_status_types
|
allowed_status_types = request.user.feed_status_types
|
||||||
count = sum(c for (k, c) in counts_by_type if k in allowed_status_types)
|
count = sum(c for (k, c) in counts_by_type if k in allowed_status_types)
|
||||||
# if "everything else" is allowed, add other types to the sum
|
# if "everything else" is allowed, add other types to the sum
|
||||||
count += sum(c for (k, c) in counts_by_type if k not in ["review", "comment", "quotation"])
|
count += sum(
|
||||||
|
c
|
||||||
|
for (k, c) in counts_by_type
|
||||||
|
if k not in ["review", "comment", "quotation"]
|
||||||
|
)
|
||||||
|
|
||||||
translation_string = lambda c: ngettext(
|
translation_string = lambda c: ngettext(
|
||||||
"Load %(count)d unread status",
|
"Load %(count)d unread status", "Load %(count)d unread statuses", c
|
||||||
"Load %(count)d unread statuses",
|
|
||||||
c
|
|
||||||
) % {"count": c}
|
) % {"count": c}
|
||||||
|
|
||||||
return JsonResponse(
|
return JsonResponse({"total": translation_string(count)})
|
||||||
{"total": translation_string(count)}
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue