1
0
mirror of synced 2024-11-24 06:20:10 +01:00

wacca: fix crash when enabling frontend with no wacca.yaml file

This commit is contained in:
Kevin Trocolli 2023-03-12 14:03:00 -04:00
parent 6fa0175baa
commit 65e9ecd58c

View File

@ -1,6 +1,7 @@
import yaml
import jinja2
from twisted.web.http import Request
from os import path
from core.frontend import FE_Base
from core.config import CoreConfig
@ -16,7 +17,10 @@ class WaccaFrontend(FE_Base):
super().__init__(cfg, environment)
self.data = WaccaData(cfg)
self.game_cfg = WaccaConfig()
self.game_cfg.update(yaml.safe_load(open(f"{cfg_dir}/wacca.yaml")))
if path.exists(f"{cfg_dir}/{WaccaConstants.CONFIG_NAME}"):
self.game_cfg.update(
yaml.safe_load(open(f"{cfg_dir}/{WaccaConstants.CONFIG_NAME}"))
)
self.nav_name = "Wacca"
def render_GET(self, request: Request) -> bytes: