]> ToastFreeware Gitweb - philipp/winterrodeln/wrpylib.git/commitdiff
Select sledrun main pages to validate JSON.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 5 Jun 2022 12:31:05 +0000 (14:31 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 5 Jun 2022 12:31:05 +0000 (14:31 +0200)
bots/sledrun_json_validate.py

index 4dbccfdb1472d9ea11f8aa4313226e69492e8c4b..d6472c5ba00e978f63fcc3170d5b07d97755cb28 100644 (file)
@@ -42,7 +42,10 @@ class SledrunFromJsonBot(
 
     def treat_page(self) -> None:
         """Load the given page, do some changes, and save it."""
 
     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)
 
         try:
             validate(instance=content_json, schema=self.sledrun_schema)
 
@@ -54,7 +57,7 @@ class SledrunFromJsonBot(
             text = str(e)
 
         summary = 'JSON Daten aktualisiert.'
             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:
 
 
 def main(*args: str) -> None: