6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +00:00

Update env renderer on config change

We have a side effect whenever we add a plugin manually to the tutor
configuration: the renderer does not update itself. We fix this by
checking the config at load time.
This commit is contained in:
Régis Behmo 2019-07-10 15:19:20 +08:00
parent 50f5af989c
commit 7fbba104a1

View File

@ -17,10 +17,12 @@ VERSION_FILENAME = "version"
class Renderer: class Renderer:
ENVIRONMENT = None ENVIRONMENT = None
ENVIRONMENT_CONFIG = None
@classmethod @classmethod
def environment(cls, config): def environment(cls, config):
if not cls.ENVIRONMENT: if cls.ENVIRONMENT_CONFIG != config:
cls.ENVIRONMENT_CONFIG = config
template_roots = [TEMPLATES_ROOT] template_roots = [TEMPLATES_ROOT]
for _, plugin_templates in plugins.iter_templates(config): for _, plugin_templates in plugins.iter_templates(config):
template_roots.append(plugin_templates) template_roots.append(plugin_templates)