From 7c2760783be880c908abbc4a43e828ce40c197f1 Mon Sep 17 00:00:00 2001 From: hkc Date: Tue, 30 Aug 2022 15:54:05 +0300 Subject: [PATCH] Ignore case in tags and removed debug print --- mastoposter/filters/text.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mastoposter/filters/text.py b/mastoposter/filters/text.py index 7ced4ec..eb7738f 100644 --- a/mastoposter/filters/text.py +++ b/mastoposter/filters/text.py @@ -17,7 +17,7 @@ class TextFilter(BaseFilter, filter_name="content"): if self.mode == "regexp": self.regexp = regexp(section["regexp"]) elif self.mode in ("hashtag", "tag"): - self.tags = set(section["tags"].split()) + self.tags = set(map(str.lower, section["tags"].split())) else: raise ValueError(f"Invalid filter mode {self.mode}") @@ -46,8 +46,7 @@ class TextFilter(BaseFilter, filter_name="content"): is not None ) elif self.tags: - print(f"{self.tags=} {source.tags=}") - return len(self.tags & {t.name for t in source.tags}) > 0 + return len(self.tags & {t.name.lower() for t in source.tags}) > 0 else: raise ValueError("Neither regexp or tags were set. Why?")