From 59aa4a275246cf00222ca02a159335efe6820b64 Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Sun, 5 Jun 2022 14:31:05 +0200 Subject: [PATCH] Select sledrun main pages to validate JSON. --- bots/sledrun_json_validate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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: -- 2.39.5