diff --git a/rowers/management/commands/processemail.py b/rowers/management/commands/processemail.py index 4719bee3..5adffab1 100644 --- a/rowers/management/commands/processemail.py +++ b/rowers/management/commands/processemail.py @@ -114,7 +114,11 @@ class Command(BaseCommand): extension = attachment.document.name[-3:].lower() try: message = Message.objects.get(id=attachment.message_id) - body = "\n".join(message.text.splitlines()) + if message.text: + body = "\n".join(message.text.splitlines()) + else: + body = message.body + uploadoptions = uploads.upload_options(body) from_address = message.from_address[0].lower() name = message.subject diff --git a/rowers/templates/document_form.html b/rowers/templates/document_form.html index 7ad85c58..c7d2cda2 100644 --- a/rowers/templates/document_form.html +++ b/rowers/templates/document_form.html @@ -53,7 +53,7 @@ If you check "make private", this workout will not be visible to your followers and will not show up in your teams' workouts list. With the Landing Page option, you can select to which (workout related) page you will be taken after a successfull upload.

-

Select Files with the File button or drag them on the marked area

+

Select Files with the File button or drag them on the marked area

@@ -141,7 +141,7 @@ $('#id_offline').prop('checked','True'); data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked')); console.log("Set offline to True"); - $('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done. The extra actions will not be performed.'); + $('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.'); $('#extra_message').addClass('message'); } } @@ -240,7 +240,7 @@ $('#id_offline').prop('checked','True'); data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked')); console.log("Set offline to True"); - $('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done. The extra actions will not be performed.'); + $('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done.'); $('#extra_message').addClass('message'); } data.set("file",f); diff --git a/rowers/uploads.py b/rowers/uploads.py index a7bd5622..8dab7755 100644 --- a/rowers/uploads.py +++ b/rowers/uploads.py @@ -191,6 +191,8 @@ def upload_options(body): body = cleanbody(body) try: yml = (yaml.load(body)) + if 'fromuploadform' in yml: + return yml try: for key, value in yml.iteritems(): lowkey = key.lower() diff --git a/rowers/views.py b/rowers/views.py index bfa49541..619a99db 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -8,6 +8,7 @@ import pytz import operator import warnings import urllib +import yaml from PIL import Image from numbers import Number from django.views.generic.base import TemplateView @@ -8551,9 +8552,14 @@ def workout_upload_view(request, ) else: workoutsbox = Mailbox.objects.filter(name='workouts')[0] + uploadoptions['fromuploadform'] = True + bodyyaml = yaml.safe_dump( + uploadoptions, + default_flow_style=False + ) msg = Message(mailbox=workoutsbox, from_header=r.user.email, - subject = t) + subject = t,body=bodyyaml) msg.save() f3 = 'media/mailbox_attachments/'+f2[6:] copyfile(f2,f3)