Private
Public Access
1
0

upload options work in background upload

This commit is contained in:
Sander Roosendaal
2017-11-08 09:22:15 +01:00
parent 70b5529029
commit a8eae5911d
4 changed files with 17 additions and 5 deletions

View File

@@ -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

View File

@@ -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.
</p>
<p>Select Files with the File button or drag them on the marked area</p>
<p><b>Select Files with the File button or drag them on the marked area</b></p>
</div>
@@ -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);

View File

@@ -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()

View File

@@ -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)