1
0
Fork 0

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

This commit is contained in:
Hay1tsme 2023-03-12 14:03:00 -04:00
parent 6fa0175baa
commit 65e9ecd58c
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import yaml import yaml
import jinja2 import jinja2
from twisted.web.http import Request from twisted.web.http import Request
from os import path
from core.frontend import FE_Base from core.frontend import FE_Base
from core.config import CoreConfig from core.config import CoreConfig
@ -16,7 +17,10 @@ class WaccaFrontend(FE_Base):
super().__init__(cfg, environment) super().__init__(cfg, environment)
self.data = WaccaData(cfg) self.data = WaccaData(cfg)
self.game_cfg = WaccaConfig() 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" self.nav_name = "Wacca"
def render_GET(self, request: Request) -> bytes: def render_GET(self, request: Request) -> bytes: