expephalon/core/modules/cron.py
Klaus-Uwe Mitterer 27fe413d11 Some refactoring to get cron running
Moved dbsettings documentation to Gitlab wiki
2020-05-24 17:44:27 +02:00

18 lines
No EOL
568 B
Python

import importlib
from django.conf import settings
cronfunctions = {}
crondefinitions = []
for module in ["core"] + settings.EXPEPHALON_MODULES:
try:
moc = importlib.import_module(f"{module}.cron")
for name, fun in moc.CRONFUNCTIONS.items():
if name in cronfunctions.keys():
raise ValueError(f"Error in {module}: Cron function with name {name} already registered!")
cronfunctions[name] = fun
crondefinitions += moc.CRONDEFINITIONS
except (AttributeError, ModuleNotFoundError):
continue