diff --git a/config.py.example b/config.py.example index 993e68bd11bd7ca73d26c0d1c84c313451b3d9a5..41fc0e60f58d25729664b523416732aa327725e4 100644 --- a/config.py.example +++ b/config.py.example @@ -157,3 +157,12 @@ LATEX_BULLETPOINTS = [ # optional: include header and footer in asta-style, not just a page number on top #LATEX_HEADER_FOOTER = True +HTML_LEVEL_OFFSET = 3 + +def dummy_todomail_provider(): + return {"example": ("Name", "mail@example.com")} + +# list of functions that return dicts mapping todomail-keys to a tuple containing name and mail address +ADDITIONAL_TODOMAIL_PROVIDERS = [ + dummy_todomail_provider +] diff --git a/tasks.py b/tasks.py index f39330901d3dbfa0d823efa8803a93d0f3983c91..9e214bec699f3f865f5223d1e10442e06618cfb3 100644 --- a/tasks.py +++ b/tasks.py @@ -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(TodoMail.name.ilike(user)).first() + 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)) db.session.add(error)