made the following changes to rss.py to fix it:
Code: Select all
@@ -418,20 +418,22 @@
for n in xrange(regcount):
if reEnabled[n]:
if category and reTypes[n] == 'C':
- found = re.search(regexes[n], category)
+ found = regexes[n].search(category)
if not found:
- logging.debug("Filter rejected on rule %d", n)
+ logging.debug("Filter unmatched on rule %d", n)
result = False
+ else:
+ logging.debug("Filter matched on rule %d", n)
+ result = True
break
else:
if regexes[n]:
- found = re.search(regexes[n], title)
+ found = regexes[n].search(title)
else:
found = False
if reTypes[n] == 'M' and not found:
- logging.debug("Filter rejected on rule %d", n)
+ logging.debug("Filter unmatched on rule %d", n)
result = False
- break
if found and reTypes[n] == 'A':
logging.debug("Filter matched on rule %d", n)
result = True- without the additional "else", RequiresCat rules that pass are never counted.
- some of the "break" statements prevent rule fallthrough where it should not be prevented (in the previous code, only the first rule would ever be evaluated because it would "break" on a failure to match)
- it is unnecessary to use re.search because regexes[n] is already a compiled re object, so regexes[n].search is better.

