From ecd29b6d546f6509c616c4809ef2add1cf31c694 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 17 Jan 2024 20:02:35 +0000 Subject: [PATCH] Tidying --- content.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content.py b/content.py index 41b24e449..4bd9ba314 100644 --- a/content.py +++ b/content.py @@ -2262,7 +2262,7 @@ def _load_auto_cw(base_dir: str, nickname: str, domain: str) -> []: return [] try: with open(auto_cw_filename, 'r', encoding='utf-8') as fp_auto: - return fp_auto.readlines() + return fp_auto.read().split('\n') except OSError: print('EX: unable to load auto cw file ' + auto_cw_filename) return [] @@ -2278,10 +2278,13 @@ def add_auto_cw(base_dir: str, nickname: str, domain: str, for cw_rule in auto_cw_list: if '->' not in cw_rule: continue - rulematch = cw_rule.split('->')[0].strip() + sections = cw_rule.split('->') + rulematch = sections[0].strip() if rulematch not in content: continue - cw_str = cw_rule.split('->')[1].strip() + cw_str = sections[1].strip() + if not cw_str: + continue if new_subject: if cw_str not in new_subject: new_subject += ', ' + cw_str