Skip to content

Commit

Permalink
chore(feed): use config system to specify amount of advisory entries
Browse files Browse the repository at this point in the history
  • Loading branch information
anthraxx committed Mar 31, 2022
1 parent 2e5ab70 commit e55c2c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
1 change: 1 addition & 0 deletions config/00-default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tracker/view/advisory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit e55c2c0

Please sign in to comment.