Fix pylint

This commit is contained in:
Joachim 2021-11-22 00:46:24 +01:00
parent bc7de410b7
commit 0b46db49a3

View file

@ -11,7 +11,6 @@ from django.views import View
from bookwyrm import activitystreams, forms, models from bookwyrm import activitystreams, forms, models
from bookwyrm.activitypub import ActivitypubResponse from bookwyrm.activitypub import ActivitypubResponse
from bookwyrm.models import User
from bookwyrm.settings import PAGE_LENGTH, STREAMS from bookwyrm.settings import PAGE_LENGTH, STREAMS
from bookwyrm.suggested_users import suggested_users from bookwyrm.suggested_users import suggested_users
from .helpers import get_user_from_username from .helpers import get_user_from_username
@ -24,6 +23,7 @@ class Feed(View):
"""activity stream""" """activity stream"""
def post(self, request, tab): def post(self, request, tab):
"""save feed settings form, with a silent validation fail"""
settings_saved = False settings_saved = False
form = forms.FeedStatusTypes(request.POST, instance=request.user) form = forms.FeedStatusTypes(request.POST, instance=request.user)
if form.is_valid(): if form.is_valid():
@ -250,7 +250,11 @@ def get_suggested_books(user, max_books=5):
return suggested_books return suggested_books
def filter_stream_by_status_type(activities, allowed_types=[]): def filter_stream_by_status_type(activities, allowed_types=None):
if not allowed_types:
allowed_types = []
"""filter out activities based on types"""
if "review" not in allowed_types: if "review" not in allowed_types:
activities = activities.filter(Q(review__isnull=True)) activities = activities.filter(Q(review__isnull=True))
if "comment" not in allowed_types: if "comment" not in allowed_types: