From: Philipp Spitzer Date: Sun, 22 May 2022 14:16:01 +0000 (+0200) Subject: Only offer to add map if it exists. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wrpylib.git/commitdiff_plain/6affb340f490909f6a57fe8cb81aee244db14836 Only offer to add map if it exists. --- diff --git a/bots/sledrun_wikitext_to_json.py b/bots/sledrun_wikitext_to_json.py index 196c0ce..b41840c 100644 --- a/bots/sledrun_wikitext_to_json.py +++ b/bots/sledrun_wikitext_to_json.py @@ -446,9 +446,10 @@ class SledrunWikiTextToJsonBot( pywikibot.output('\03{lightpurple}---\03{default}') self.userPut(sledrun_json_page, sledrun_json_page.text, sledrun_json_text, summary=summary, contentmodel='json') - map_json_text = json.dumps(map_json, ensure_ascii=False, indent=4) - summary = 'Landkarte konvertiert von Wikitext nach JSON.' - self.userPut(map_json_page, map_json_page.text, map_json_text, summary=summary, contentmodel='json') + if map_json is not None: + map_json_text = json.dumps(map_json, ensure_ascii=False, indent=4) + summary = 'Landkarte konvertiert von Wikitext nach JSON.' + self.userPut(map_json_page, map_json_page.text, map_json_text, summary=summary, contentmodel='json') def main(*args: str) -> None: