From eccd193ebc875293d5303e1a21445555bdc40daa Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 24 Jun 2023 00:28:03 +0200 Subject: Addresses some flake8 warnings. --- newspipe/commands.py | 5 +++-- newspipe/controllers/article.py | 2 +- newspipe/controllers/feed.py | 1 + newspipe/lib/feed_utils.py | 1 - newspipe/models/article.py | 2 +- newspipe/web/views/feed.py | 1 - newspipe/web/views/session_mgmt.py | 8 ++++++-- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/newspipe/commands.py b/newspipe/commands.py index c7aeb96c..f5128148 100755 --- a/newspipe/commands.py +++ b/newspipe/commands.py @@ -4,8 +4,6 @@ from datetime import date from datetime import datetime import click -from sqlalchemy import text -from sqlalchemy import create_engine from dateutil.relativedelta import relativedelta from werkzeug.security import generate_password_hash @@ -15,6 +13,9 @@ from newspipe.bootstrap import db from newspipe.controllers import ArticleController from newspipe.controllers import UserController +# from sqlalchemy import create_engine +# from sqlalchemy import text + logger = logging.getLogger("commands") diff --git a/newspipe/controllers/article.py b/newspipe/controllers/article.py index d5ded05a..f82ca559 100644 --- a/newspipe/controllers/article.py +++ b/newspipe/controllers/article.py @@ -66,7 +66,7 @@ class ArticleController(AbstractController): try: cat = CategoryController().get(id=attrs["category_id"]) assert self.user_id is None or cat.user_id == user_id, ( - "no right on cat %r" % cat.id + "no right on cat %r" % cat.id ) except Exception: pass diff --git a/newspipe/controllers/feed.py b/newspipe/controllers/feed.py index b8856966..9461a798 100644 --- a/newspipe/controllers/feed.py +++ b/newspipe/controllers/feed.py @@ -95,6 +95,7 @@ class FeedController(AbstractController): def update(self, filters, attrs): from .article import ArticleController + self._ensure_icon(attrs) # if "category_id" in attrs and attrs["category_id"] == 0: # del attrs["category_id"] diff --git a/newspipe/lib/feed_utils.py b/newspipe/lib/feed_utils.py index 15b3076c..a404d5fa 100644 --- a/newspipe/lib/feed_utils.py +++ b/newspipe/lib/feed_utils.py @@ -120,7 +120,6 @@ def construct_feed_from(url=None, fp_parsed=None, feed=None, query_site=True): return wrapper if not feed.get("icon_url"): - icons = bs_parsed.find_all(check_keys(rel=["icon", "shortcut"])) if not len(icons): icons = bs_parsed.find_all(check_keys(rel=["icon"])) diff --git a/newspipe/models/article.py b/newspipe/models/article.py index 9f451af5..ae7e2b11 100644 --- a/newspipe/models/article.py +++ b/newspipe/models/article.py @@ -26,7 +26,7 @@ __license__ = "GPLv3" from datetime import datetime -from sqlalchemy import Index, ForeignKeyConstraint +# from sqlalchemy import Index, ForeignKeyConstraint from sqlalchemy.ext.associationproxy import association_proxy from newspipe.bootstrap import db diff --git a/newspipe/web/views/feed.py b/newspipe/web/views/feed.py index 16059319..9499ba01 100644 --- a/newspipe/web/views/feed.py +++ b/newspipe/web/views/feed.py @@ -234,7 +234,6 @@ def form(feed_id=None): @feed_bp.route("/edit/", methods=["POST"]) @login_required def process_form(feed_id=None): - form = AddFeedForm() feed_contr = FeedController(current_user.id) form.set_category_choices(CategoryController(current_user.id).read()) diff --git a/newspipe/web/views/session_mgmt.py b/newspipe/web/views/session_mgmt.py index 0154503a..5da74720 100644 --- a/newspipe/web/views/session_mgmt.py +++ b/newspipe/web/views/session_mgmt.py @@ -4,8 +4,8 @@ from datetime import datetime from flask import current_app from flask import flash from flask import redirect -from flask import request from flask import render_template +from flask import request from flask import session from flask import url_for from flask_babel import gettext @@ -84,7 +84,11 @@ def login(): if request.method == "POST" and form.validate(): # fixes an issue in flask-wtf login_user_bundle(form.user) return form.redirect("home") - return render_template("login.html", form=form, self_registration=application.config["SELF_REGISTRATION"]) + return render_template( + "login.html", + form=form, + self_registration=application.config["SELF_REGISTRATION"], + ) @current_app.route("/logout") -- cgit