=== modified file 'launchpadbugs/basebuglistfilter.py' --- launchpadbugs/basebuglistfilter.py 2008-01-12 13:08:09 +0000 +++ launchpadbugs/basebuglistfilter.py 2008-02-22 10:25:06 +0000 @@ -108,6 +108,35 @@ return not (False in conditions) and bug else: return True in conditions and bug + +def datereported(bug, cls=None, **date_def): + """ + date_def["<"], type: datetime + date_def[">"], type: datetime + date_def["="], type: datetime + """ + if not date_def: + raise TypeError, "date_created-function needs at least one definitional argument" + if not len(date_def) == 1 or not set(date_def.keys()) <= set(["=","<",">"]): + raise TypeError, "unknown definitional argument for lastcomment" + op, value = date_def.items().pop() + if not hasattr(bug, "infotable"): + bug = cls(bug) + if op == "=": + if dc > value: + return False + elif dc == value: + return bug + else: + raise StopFiltering + elif op == "<": + if not False in map(lambda x: x.date_created > value, bug.infotable): + raise StopFiltering + else: + if not False in map(lambda x: x.date_created < value, bug.infotable): + raise StopFiltering + return bug + class StopFiltering(StopIteration): @@ -180,7 +209,8 @@ "tag": 'field.tag', "reporter": "field.bug_reporter", "duplicates": 'field.omit_dupes', - "component": 'field.component'} + "component": 'field.component', + "orderby": "orderby"} def __init__(self, url_opt="", func=[], opt_type=CONFLICTS_ERROR):