From e55c2c0a2d1ef942f2c2e3d483d9296124a947fd Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Wed, 30 Mar 2022 02:18:16 +0200 Subject: [PATCH] chore(feed): use config system to specify amount of advisory entries --- config.py | 1 + config/00-default.conf | 1 + tracker/view/advisory.py | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 106f8330..8cc80f91 100644 --- a/config.py +++ b/config.py @@ -40,6 +40,7 @@ def set_debug_flag(debug): TRACKER_PASSWORD_LENGTH_MAX = config_tracker.getint('password_length_max') TRACKER_SUMMARY_LENGTH_MAX = config_tracker.getint('summary_length_max') TRACKER_LOG_ENTRIES_PER_PAGE = config_tracker.getint('log_entries_per_page') +TRACKER_FEED_ADVISORY_ENTRIES = config_tracker.getint('feed_advisory_entries') config_sqlite = config['sqlite'] SQLITE_JOURNAL_MODE = config_sqlite['journal_mode'] diff --git a/config/00-default.conf b/config/00-default.conf index 9eb7c466..ae01afc2 100644 --- a/config/00-default.conf +++ b/config/00-default.conf @@ -8,6 +8,7 @@ password_length_min = 16 password_length_max = 64 summary_length_max = 200 log_entries_per_page = 10 +feed_advisory_entries = 15 [pacman] handle_cache_time = 120 diff --git a/tracker/view/advisory.py b/tracker/view/advisory.py index 1450b53f..d659f2b8 100644 --- a/tracker/view/advisory.py +++ b/tracker/view/advisory.py @@ -10,6 +10,7 @@ from pytz import UTC from sqlalchemy import and_ +from config import TRACKER_FEED_ADVISORY_ENTRIES from config import TRACKER_ISSUE_URL from tracker import db from tracker import tracker @@ -60,8 +61,8 @@ def get_advisory_data(): @tracker.route('/advisories/feed.atom', methods=['GET']) @tracker.route('/advisory/feed.atom', methods=['GET']) def advisory_atom(): - last_recent_entries = 15 - data = get_advisory_data()['published'][:last_recent_entries] + data = get_advisory_data()['published'][:TRACKER_FEED_ADVISORY_ENTRIES] + feed = FeedGenerator() feed.title('Arch Linux Security - Recent advisories') feed.description('Arch Linux recent advsisories RSS feed')