REST API: Add support for idempotency keys

This commit is contained in:
Raphael Michel
2019-04-05 14:20:47 +02:00
parent db0c13a3c2
commit 0c82e92882
9 changed files with 362 additions and 11 deletions

View File

@@ -212,15 +212,21 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
order = None
else:
if attach_tickets:
args = []
attach_size = 0
for name, ct in get_tickets_for_order(order):
try:
email.attach(
name,
ct.file.read(),
ct.type
)
except:
pass
content = ct.file.read()
args.append((name, content, ct.type))
attach_size += len(content)
if attach_tickets < 4 * 1024 * 1024:
# Do not attach more than 4MB, it will bounce way to often.
for a in args:
try:
email.attach(*a)
except:
pass
email = email_filter.send_chained(event, 'message', message=email, order=order)