blob: 093b4f6eacc72205701154f3cb61b780ef8dc5c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# -*- coding: utf-8 -*-
# Author: G.J.J. van den Burg <gvandenburg@turing.ac.uk>
# License: See LICENSE file
# Copyright: 2020 (c) The Alan Turing Institute
import json
from flask import current_app, render_template
from app.email import send_email
def send_annotation_backup(record):
pretty_record = json.dumps(record, sort_keys=True, indent=4)
subject = "[Backup] New Annotation Recorded"
if current_app.debug:
subject += " (debug)"
send_email(
subject,
sender=current_app.config["ADMINS"][0],
recipients=[current_app.config["ADMINS"][0]],
text_body=render_template(
"email/annotation_record.txt", pretty_record=pretty_record
),
html_body=render_template(
"email/annotation_record.html", pretty_record=pretty_record
),
)
|