Private
Public Access
1
0

slightly improved email processing

This commit is contained in:
Sander Roosendaal
2017-10-26 22:15:01 +02:00
parent f13f0a9a7c
commit 0f5c49de62

View File

@@ -98,6 +98,7 @@ class Command(BaseCommand):
cntr = 0 cntr = 0
for attachment in attachments: for attachment in attachments:
extension = attachment.document.name[-3:].lower() extension = attachment.document.name[-3:].lower()
try:
message = Message.objects.get(id=attachment.message_id) message = Message.objects.get(id=attachment.message_id)
body = "\n".join(message.text.splitlines()) body = "\n".join(message.text.splitlines())
uploadoptions = uploads.upload_options(body) uploadoptions = uploads.upload_options(body)
@@ -108,6 +109,8 @@ class Command(BaseCommand):
rowers = [ rowers = [
r for r in Rower.objects.all() if r.user.email.lower() == from_address r for r in Rower.objects.all() if r.user.email.lower() == from_address
] ]
except IOError:
rowers = []
for rower in rowers: for rower in rowers:
if extension == 'zip': if extension == 'zip':
zip_file = zipfile.ZipFile(attachment.document) zip_file = zipfile.ZipFile(attachment.document)