From: martin@piware.de <> Date: Thu, 26 Nov 2009 10:43:59 +0000 (+0100) Subject: workitems: add assignee parsing for moin pages X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=ce21540cf666613219fb8123fd2194203c592eff;p=bin.git workitems: add assignee parsing for moin pages --- diff --git a/workitems.py b/workitems.py index e90b09d..95f8a04 100755 --- a/workitems.py +++ b/workitems.py @@ -213,23 +213,31 @@ def get_moin_workitems(url): Every line starting with "|| " is treated as a work item. - Return a list of ('item', 'status') pairs. + Return a list of ('item', 'status', 'assignee') tuples. ''' result = [] for line in urllib.urlopen(url): + assignee = 'nobody' if line.startswith('|| '): fields = line.strip().split('||') assert not fields[0] # should be empty desc = fields[1].strip() for f in fields[2:]: - if 'DONE' in f: - result.append((desc, 'done')) - break - elif 'POSTPONED' in f: - result.append((desc, 'done')) - break + if 'DONE' in f or 'POSTPONED' in f or 'TODO' in f or 'INPROGRESS' in f: + ff = f.split() + if len(ff) == 2: + assignee = ff[1] + if 'DONE' in f: + result.append((desc, 'done', assignee)) + break + elif 'POSTPONED' in f: + result.append((desc, 'postponed', assignee)) + break + else: + result.append((desc, 'todo', assignee)) + break else: - result.append((desc, 'todo')) + result.append((desc, 'todo', 'nobody')) return result @@ -475,8 +483,8 @@ def import_moin(db, urls): '''Collect blueprint work items from a moin wiki.''' for url in urls: - for (d, s) in get_moin_workitems(url): - add_work_item(db, url, d, s, 'nobody') + for (d, s, a) in get_moin_workitems(url): + add_work_item(db, url, d, s, a) # # main