6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-10 23:30:59 +00:00

fix: render list config items

Close #867.
This commit is contained in:
Régis Behmo 2023-09-05 16:00:01 +02:00 committed by Régis Behmo
parent 39d3eaf801
commit 8eccaa61e9
3 changed files with 4 additions and 0 deletions

View File

@ -0,0 +1 @@
- [Bugfix] Render config settings that are inside lists. (by @regisb)

View File

@ -64,6 +64,7 @@ class EnvTests(PluginsTestCase):
}
self.assertEqual("ab", env.render_unknown(config, "{{ var1 }}b"))
self.assertEqual({"x": "ac"}, env.render_unknown(config, {"x": "{{ var1 }}c"}))
self.assertEqual(["x", "ac"], env.render_unknown(config, ["x", "{{ var1 }}c"]))
def test_common_domain(self) -> None:
self.assertEqual(

View File

@ -376,6 +376,8 @@ def render_unknown(config: Config, value: t.Any) -> t.Any:
return render_str(config, value)
if isinstance(value, dict):
return {k: render_unknown(config, v) for k, v in value.items()}
if isinstance(value, list):
return [render_unknown(config, v) for v in value]
return value