示例#1
0
def parse_report_group(people, elem):
    name, title = name_and_title(elem)
    group = PeopleReportGroup(title)
    sub_order = []
    for sub_name, sub in parse_reports(people, elem):
        group[sub_name] = sub
        sub_order.append(sub_name)
    group.order = tuple(sub_order)
    return name, group
示例#2
0
文件: peopleconf.py 项目: zagy/karl
def parse_report_group(people, elem):
    name, title = name_and_title(elem)
    group = PeopleReportGroup(title)
    sub_order = []
    for sub_name, sub in parse_reports(people, elem):
        group[sub_name] = sub
        sub_order.append(sub_name)
    group.order = tuple(sub_order)
    return name, group
示例#3
0
def parse_reports(people, parent_elem, reportmap):
    contents = []
    for e in parent_elem:
        if isinstance(e, etree._Comment):
            continue

        if e.tag == 'report-group':
            obj = PeopleReportGroup(e.get('title'))
            obj.set_reports(parse_reports(people, e, reportmap))
            contents.append(obj)
        elif e.tag == 'report':
            reportid, obj = parse_report(people, e)
            if reportid in reportmap:
                raise ParseError("Non-unique report ID", e)
            reportmap[reportid] = obj
            contents.append(obj)
        else:
            raise ParseError('Unrecognized element', e)
    return contents