mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-13 14:43:03 +00:00
fix: TypeError when PLUGINS is None
When the PLUGINS config entry is None (`PLUGINS:`), the following error was being triggered: File "/.../tutor/tutor/plugins.py", line 304, in is_enabled return name in config.get(CONFIG_KEY, []) TypeError: argument of type 'NoneType' is not iterable
This commit is contained in:
parent
8db1495497
commit
c01f4476b8
@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
|
||||
|
||||
## Unreleased
|
||||
|
||||
- [Bugfix] Fix edge case where `PLUGINS` entry is null in config.yml.
|
||||
- [Bugfix] Fix missing py2neo dependency in `images build openedx` (#411).
|
||||
|
||||
## v11.2.4 (2021-03-17)
|
||||
|
@ -81,6 +81,10 @@ class PluginsTests(unittest.TestCase):
|
||||
self.assertEqual([], config["PLUGINS"])
|
||||
self.assertNotIn("KEY", config)
|
||||
|
||||
def test_none_plugins(self) -> None:
|
||||
config = {plugins.CONFIG_KEY: None}
|
||||
self.assertFalse(plugins.is_enabled(config, "myplugin"))
|
||||
|
||||
def test_patches(self) -> None:
|
||||
class plugin1:
|
||||
patches = {"patch1": "Hello {{ ID }}"}
|
||||
|
@ -410,7 +410,8 @@ def iter_enabled(config: Dict[str, Any]) -> Iterator[BasePlugin]:
|
||||
|
||||
|
||||
def is_enabled(config: Dict[str, Any], name: str) -> bool:
|
||||
return name in config.get(CONFIG_KEY, [])
|
||||
plugin_list = config.get(CONFIG_KEY) or []
|
||||
return name in plugin_list
|
||||
|
||||
|
||||
def iter_patches(config: Dict[str, str], name: str) -> Iterator[Tuple[str, str]]:
|
||||
|
Loading…
Reference in New Issue
Block a user