diff options
-rwxr-xr-x | osm_proposals/proposals.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/osm_proposals/proposals.py b/osm_proposals/proposals.py index c111699..1bb1f14 100755 --- a/osm_proposals/proposals.py +++ b/osm_proposals/proposals.py @@ -42,7 +42,11 @@ def run(): rvprop='content', rvslots='main', ): - proposal = parse_proposal(page, langs) + proposal = parse_proposal( + page_title=page['title'], + text=page['revisions'][0]['slots']['main']['content'], + langs=langs, + ) if proposal: proposals.append(proposal) @@ -91,9 +95,7 @@ def is_stub(doc): return False -def parse_proposal(page: dict, langs: Container[str]) -> dict | None: - page_title = page['title'] - text = page['revisions'][0]['slots']['main']['content'] +def parse_proposal(page_title: str, text: str, langs: Container[str]) -> dict | None: doc = mwparserfromhell.parse(text) proposal_page_templates = doc.filter_templates( matches=lambda t: t.name.matches('Proposal page') @@ -116,9 +118,9 @@ def parse_proposal(page: dict, langs: Container[str]) -> dict | None: if is_stub(doc): if status in ('approved', 'rejected'): - eprint(f'WARNING {status} proposal is a stub', page['title']) + eprint(f'WARNING {status} proposal is a stub', page_title) else: - eprint('skipping stub', page['title']) + eprint('skipping stub', page_title) return None name = get_template_val(tpl, 'name') |