From: Philipp Spitzer Date: Sun, 5 Jun 2022 12:31:05 +0000 (+0200) Subject: Select sledrun main pages to validate JSON. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wrpylib.git/commitdiff_plain/59aa4a275246cf00222ca02a159335efe6820b64 Select sledrun main pages to validate JSON. --- diff --git a/bots/sledrun_json_validate.py b/bots/sledrun_json_validate.py index 4dbccfd..d6472c5 100644 --- a/bots/sledrun_json_validate.py +++ b/bots/sledrun_json_validate.py @@ -42,7 +42,10 @@ class SledrunFromJsonBot( def treat_page(self) -> None: """Load the given page, do some changes, and save it.""" - content_json = json.loads(self.current_page.text) + sledrun_json_page = Page(self.site, self.current_page.title() + '/Rodelbahn.json') + if not sledrun_json_page.exists(): + return + content_json = json.loads(sledrun_json_page.text) try: validate(instance=content_json, schema=self.sledrun_schema) @@ -54,7 +57,7 @@ class SledrunFromJsonBot( text = str(e) summary = 'JSON Daten aktualisiert.' - self.put_current(text, summary=summary) + self.userPut(sledrun_json_page, sledrun_json_page.text, text, summary=summary, contentmodel='json') def main(*args: str) -> None: