Skip to content
Snippets Groups Projects
Commit bca95c4d authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

WIP: send mails to responsible people

parent 8c9ce466
No related branches found
No related tags found
2 merge requests!39Release 0.4.0,!20created draft for generic analysis method
Pipeline #16475 passed
......@@ -52,9 +52,12 @@ def main():
)
da.add_property("date", "2020-01-01")
da.add_property("identifier", "TEST")
da.add_property("responsible", db.execute_query(
only = db.execute_query(
"FIND RECORD Person WITH firstname=Only",
unique=True))
unique=True)
only.add_property(db.Property("Email").retrieve().id, "only@example.com")
only.update()
da.add_property("responsible", only)
da.insert()
......
......@@ -47,7 +47,7 @@ logger = logging.getLogger(__name__)
guard.set_level(level=UPDATE)
def send_mail(self, changes):
def send_mail(self, changes, receipient):
""" calls sendmail in order to send a mail to the curator about pending
changes
......@@ -64,7 +64,7 @@ The following changes where done automatically.
""".format(changes="\n".join(changes))
try:
fro = caosdb_config["advancedtools"]["automated_updates.from_mail"]
to = caosdb_config["advancedtools"]["automated_updates.to_mail"]
to = receipient
except KeyError:
logger.error("Server Configuration is missing a setting for "
"sending mails. The administrator should check "
......@@ -141,7 +141,12 @@ def main(args):
)
if len(to_be_updated) > 0:
send_mail(to_be_updated)
people = db.execute_query("FIND RECORD Person WHICH IS REFERENCEED BY "
"{}".format(dataAnalysisRecord.id))
for person in people:
if person.get_property("Email") is not None:
send_mail(to_be_updated, receipient=person.get_property(
"Email"))
# TODO (must) what should be done with the old file? Removed if not referenced?
......
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