=== modified file 'launchpadbugs/buglist_filter.py' --- launchpadbugs/buglist_filter.py 2007-09-12 09:43:30 +0000 +++ launchpadbugs/buglist_filter.py 2007-09-13 07:44:32 +0000 @@ -8,6 +8,8 @@ import time import urlparse import urllib +import re +import sys class Filter(object): def __init__(self, methode): @@ -44,7 +46,14 @@ self.functions.add(self.func_reporter) if lastcomment: - for i in lastcomment.split(" "): + x = re.split(r" *( |\||&) *", lastcomment) + assert len(x) in [1,3], "wrong number of lastcomment arguments" + if len(x) == 3: + y = x.pop(1) + if y == " ": + y = "|" + self.lastcomment["operation"] = y + for i in x: if i.startswith("d:"): self.lastcomment["date"] = i.lstrip("d:") try: @@ -53,7 +62,7 @@ print >> sys.stderr, "The given date must be in the format 'Year-Month-day'. Ignoring given date!" self.lastcomment["date"] = None else: - self.lastcomment["user"] = i.lstrip("u:") + self.lastcomment["user"] = i.lstrip("u:") self.functions.add(self.func_lastcomment) @@ -65,7 +74,7 @@ self.closed_bugs = None self.duplicates = None self.functions = set() - self.lastcomment = {"user" : None, "date" : None} + self.lastcomment = {"user" : None, "date" : None, "operation": "|"} self.minbug = 0 self.filterbugs = list() self.reporters = None @@ -122,12 +131,20 @@ else: lp_user = self.lastcomment["user"] comments = b.comments + check_user = None + check_date = None if comments: if (self.lastcomment["user"] and comments[-1].user == lp_user): - result.add(b) + check_user = True if self.lastcomment["date"]: t = time.mktime(time.strptime(comments[-1].date, "%Y-%m-%d %H:%M:%S %Z")) if (t - self.lastcomment["date"]) < 0: + check_date = True + if self.lastcomment["operation"] == "|": + if check_user or check_date: + result.add(b) + elif self.lastcomment["operation"] == "&": + if check_user and check_date: result.add(b) return result