From 816e5b77b8dd6ea8e26c307415d7eaa9ac4b5d08 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 10 Dec 2020 22:48:09 +0100 Subject: harmonize CRAWLER_RESOLVE_ARTICLE_URL configuration variable. --- instance/config.py | 3 +-- instance/sqlite.py | 3 +-- newspipe/controllers/feed.py | 6 +++--- newspipe/lib/article_utils.py | 2 +- newspipe/web/views/feed.py | 5 +++-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/instance/config.py b/instance/config.py index 8a3fdb6b..89655edf 100644 --- a/instance/config.py +++ b/instance/config.py @@ -48,8 +48,7 @@ DEFAULT_MAX_ERROR = 6 HTTP_PROXY = "" CRAWLER_USER_AGENT = "Newspipe (https://git.sr.ht/~cedric/newspipe)" CRAWLER_TIMEOUT = 30 -CRAWLER_RESOLV = False -RESOLVE_ARTICLE_URL = False +CRAWLER_RESOLVE_ARTICLE_URL = False FEED_REFRESH_INTERVAL = 120 # Notification diff --git a/instance/sqlite.py b/instance/sqlite.py index 60047080..0fec8f3d 100644 --- a/instance/sqlite.py +++ b/instance/sqlite.py @@ -40,8 +40,7 @@ DEFAULT_MAX_ERROR = 6 HTTP_PROXY = "" CRAWLER_USER_AGENT = "Newspipe (https://git.sr.ht/~cedric/newspipe)" CRAWLER_TIMEOUT = 30 -CRAWLER_RESOLV = False -RESOLVE_ARTICLE_URL = False +CRAWLER_RESOLVE_ARTICLE_URL = False FEED_REFRESH_INTERVAL = 0 # Notification diff --git a/newspipe/controllers/feed.py b/newspipe/controllers/feed.py index 8a1b6b0b..72f9b180 100644 --- a/newspipe/controllers/feed.py +++ b/newspipe/controllers/feed.py @@ -98,9 +98,9 @@ class FeedController(AbstractController): from .article import ArticleController self._ensure_icon(attrs) - if "category_id" in attrs and attrs["category_id"] == 0: - del attrs["category_id"] - elif "category_id" in attrs: + # if "category_id" in attrs and attrs["category_id"] == 0: + # del attrs["category_id"] + if "category_id" in attrs: art_contr = ArticleController(self.user_id) for feed in self.read(**filters): art_contr.update( diff --git a/newspipe/lib/article_utils.py b/newspipe/lib/article_utils.py index d343f0a1..90b97752 100644 --- a/newspipe/lib/article_utils.py +++ b/newspipe/lib/article_utils.py @@ -87,7 +87,7 @@ async def get_article_details(entry, fetch=True): article_title = html.unescape(entry.get("title", "")) if ( fetch - and application.config["CRAWLER_RESOLV"] + and application.config["CRAWLER_RESOLVE_ARTICLE_URL"] and article_link or not article_title ): diff --git a/newspipe/web/views/feed.py b/newspipe/web/views/feed.py index 5fa2070b..73d68c94 100644 --- a/newspipe/web/views/feed.py +++ b/newspipe/web/views/feed.py @@ -256,8 +256,8 @@ def process_form(feed_id=None): "category_id": form.category_id.data, "private": form.private.data, } - if not feed_attr["category_id"] or feed_attr["category_id"] == "0": - del feed_attr["category_id"] + # if not feed_attr["category_id"] or feed_attr["category_id"] == "0": + # del feed_attr["category_id"] for filter_attr in ("type", "pattern", "action on", "action"): for i, value in enumerate(request.form.getlist(filter_attr.replace(" ", "_"))): @@ -267,6 +267,7 @@ def process_form(feed_id=None): if feed_id is not None: # Edit an existing feed + print(feed_attr["category_id"]) feed_contr.update({"id": feed_id}, feed_attr) flash( gettext( -- cgit