handle non-existent icons
Django CI/CD / test (push) Successful in 58s Details
Django CI/CD / build-and-push (push) Has been cancelled Details

This commit is contained in:
Lukáš Kucharczyk 2024-11-09 21:28:52 +00:00
parent cf503a7b7d
commit 8fc65f467c
1 changed files with 5 additions and 1 deletions

View File

@ -128,7 +128,11 @@ def Icon(
name: str, name: str,
attributes: list[HTMLAttribute] = [], attributes: list[HTMLAttribute] = [],
): ):
return Component(template=f"cotton/icon/{name}.html", attributes=attributes) try:
result = Component(template=f"cotton/icon/{name}.html", attributes=attributes)
except TemplateDoesNotExist:
result = Icon(name="unspecified", attributes=attributes)
return result
def LinkedNameWithPlatformIcon(name: str, game_id: int, platform: str) -> SafeText: def LinkedNameWithPlatformIcon(name: str, game_id: int, platform: str) -> SafeText: