From fdbabd57aba16d0155b9cd6a31ffe191c2717f54 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 3 Dec 2017 20:18:24 +0100 Subject: [PATCH] fixed email processing bug --- rowers/management/commands/processemail.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rowers/management/commands/processemail.py b/rowers/management/commands/processemail.py index 1d2424e4..80540061 100644 --- a/rowers/management/commands/processemail.py +++ b/rowers/management/commands/processemail.py @@ -48,16 +48,18 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False): except AttributeError: filename = fileobj[6:] + # test if file exists and is not empty try: - with open(filename,'r') as fop: + with open('media/'+filename,'r') as fop: line = fop.readline() except IOError: return 0 - + workoutid = [ make_new_workout_from_email(rower, filename, title,testing=testing) ] + if workoutid[0]: link = settings.SITE_URL+reverse( rower.defaultlandingpage, @@ -154,9 +156,6 @@ class Command(BaseCommand): body = "\n".join(message.text.splitlines()) else: body = message.get_body() - - - uploadoptions = uploads.upload_options(body)