mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-27 04:09:56 +00:00
sith/toolbar_debug: don't fail when there is no template
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
# -*- coding:utf-8 -*
|
# -*- coding:utf-8 -*
|
||||||
#
|
#
|
||||||
# Copyright 2016,2017
|
# Copyright 2016,2017,2021
|
||||||
# - Sli <antoine@bartuccio.fr>
|
# - Sli <antoine@bartuccio.fr>
|
||||||
|
# - Skia <skia@hya.sk>
|
||||||
#
|
#
|
||||||
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
|
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
|
||||||
# http://ae.utbm.fr.
|
# http://ae.utbm.fr.
|
||||||
@@ -27,7 +28,10 @@ from debug_toolbar.panels.templates import TemplatesPanel as BaseTemplatesPanel
|
|||||||
|
|
||||||
class TemplatesPanel(BaseTemplatesPanel):
|
class TemplatesPanel(BaseTemplatesPanel):
|
||||||
def generate_stats(self, *args):
|
def generate_stats(self, *args):
|
||||||
|
try:
|
||||||
template = self.templates[0]["template"]
|
template = self.templates[0]["template"]
|
||||||
if not hasattr(template, "engine") and hasattr(template, "backend"):
|
if not hasattr(template, "engine") and hasattr(template, "backend"):
|
||||||
template.engine = template.backend
|
template.engine = template.backend
|
||||||
|
except IndexError: # No template
|
||||||
|
pass
|
||||||
return super().generate_stats(*args)
|
return super().generate_stats(*args)
|
||||||
|
Reference in New Issue
Block a user