Skip to content
Snippets Groups Projects
Verified Commit aebb9bf5 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Use a set for the data check registry to prevent double entries

parent f493f004
No related branches found
No related tags found
1 merge request!649Resolve "Register data checks only one time"
Pipeline #15251 passed
...@@ -20,6 +20,7 @@ Fixed ...@@ -20,6 +20,7 @@ Fixed
~~~~~ ~~~~~
* Fix installation documentation (nginx, uWSGI). * Fix installation documentation (nginx, uWSGI).
* Use a set for data checks registry to prevent double entries.
Removed Removed
~~~~~~~ ~~~~~~~
......
...@@ -74,9 +74,9 @@ class CoreConfig(AppConfig): ...@@ -74,9 +74,9 @@ class CoreConfig(AppConfig):
"""Get all data checks from all loaded models.""" """Get all data checks from all loaded models."""
from aleksis.core.data_checks import DataCheckRegistry from aleksis.core.data_checks import DataCheckRegistry
data_checks = [] data_checks = set()
for model in apps.get_models(): for model in apps.get_models():
data_checks += getattr(model, "data_checks", []) data_checks.update(getattr(model, "data_checks", []))
DataCheckRegistry.data_checks = data_checks DataCheckRegistry.data_checks = data_checks
def preference_updated( def preference_updated(
......
...@@ -225,7 +225,7 @@ class DataCheck: ...@@ -225,7 +225,7 @@ class DataCheck:
class DataCheckRegistry: class DataCheckRegistry:
"""Create central registry for all data checks in AlekSIS.""" """Create central registry for all data checks in AlekSIS."""
data_checks = [] data_checks: set = set()
@classproperty @classproperty
def data_checks_by_name(cls): def data_checks_by_name(cls):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment