Commit 7fdc3464 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Add option for additional todomail providers

/close #76
parent 6e6f7935
......@@ -157,3 +157,12 @@ LATEX_BULLETPOINTS = [
# optional: include header and footer in asta-style, not just a page number on top
def dummy_todomail_provider():
return {"example": ("Name", "")}
# list of functions that return dicts mapping todomail-keys to a tuple containing name and mail address
......@@ -611,8 +611,20 @@ def send_todomails_async(protocol_id):
for user in users
subject = "Du hast noch was zu tun!"
todomail_providers = getattr(config, "ADDITIONAL_TODOMAIL_PROVIDERS", None)
additional_todomails = {}
if todomail_providers:
for provider in todomail_providers:
todomail_dict = provider()
for key in todomail_dict:
if key not in additional_todomails:
name, mail = todomail_dict[key]
additional_todomails[key] = TodoMail(name, mail)
for user in users:
todomail = TodoMail.query.filter(
if todomail is None:
if user in additional_todomails:
todomail = additional_todomails[user]
if todomail is None:
error = protocol.create_error("Sending Todomail", "Sending Todomail failed.", "User {} has no Todo-Mail-Assignment.".format(user))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment