From 6d99b4e367cc02f5101c783c5f8a8ab4183ff4df Mon Sep 17 00:00:00 2001 From: bashrc Date: Tue, 28 Apr 2026 23:06:35 +0100 Subject: [PATCH] Replace file operations with function --- webapp_timeline.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/webapp_timeline.py b/webapp_timeline.py index 50497c3a3..86dc4e47a 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -52,6 +52,7 @@ from announce import is_self_announce from question import is_html_question from question import is_question from data import load_string +from data import load_list def _log_timeline_timing(enable_timing_log: bool, timeline_start_time, @@ -664,28 +665,27 @@ def html_timeline(default_timeline: str, follow_requests_filename = \ acct_dir(base_dir, nickname, domain) + '/followrequests.txt' if os.path.isfile(follow_requests_filename): - try: - with open(follow_requests_filename, 'r', - encoding='utf-8') as fp_foll: - for line in fp_foll: - if not line: - continue - # show follow approvals icon - follow_approvals = \ - '' + \ - '' + \
-                        translate['Approve follow requests'] + \
-                        '\n' - break - except OSError: - print('EX: html_timeline unable to read ' + - follow_requests_filename) + follow_requests_list: list[str] = \ + load_list(follow_requests_filename, + 'EX: html_timeline unable to read ' + + follow_requests_filename) + if follow_requests_list is not None: + for line in follow_requests_list: + if not line: + continue + # show follow approvals icon + follow_approvals = \ + '' + \ + '' + \
+                    translate['Approve follow requests'] + \
+                    '\n' + break _log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '3')