From ce21540cf666613219fb8123fd2194203c592eff Mon Sep 17 00:00:00 2001 From: "martin@piware.de" <> Date: Thu, 26 Nov 2009 11:43:59 +0100 Subject: [PATCH] workitems: add assignee parsing for moin pages --- workitems.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) 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 -- 2.39.5