Private
Public Access
1
0

background processed email now create Django_Mailbox message object

This commit is contained in:
Sander Roosendaal
2017-11-07 11:15:35 +01:00
parent 212f6b323c
commit 4f9539835f
2 changed files with 20 additions and 6 deletions

View File

@@ -305,6 +305,7 @@ def handle_zip_file(emailfrom, subject, file,**kwargs):
if debug: if debug:
print message print message
email = EmailMessage(subject, message, email = EmailMessage(subject, message,
emailfrom, emailfrom,
['workouts@rowsandall.com']) ['workouts@rowsandall.com'])

View File

@@ -143,6 +143,8 @@ from rq.registry import StartedJobRegistry
from rq import Queue,cancel_job from rq import Queue,cancel_job
from django.core.cache import cache from django.core.cache import cache
from django_mailbox.models import Message,Mailbox,MessageAttachment
# Utility to get stroke data in a JSON response # Utility to get stroke data in a JSON response
class JSONResponse(HttpResponse): class JSONResponse(HttpResponse):
@@ -8548,12 +8550,23 @@ def workout_upload_view(request,
notes='' notes=''
) )
else: else:
job = myqueue( workoutsbox = Mailbox.objects.filter(name='workouts')[0]
queuehigh, msg = Message(mailbox=workoutsbox,
handle_zip_file, from_header=r.user.email,
r.user.email, subject = t)
t, msg.save()
f2) f3 = 'media/mailbox_attachments/'+f2[6:]
copyfile(f2,f3)
f3 = f3[6:]
a = MessageAttachment(message=msg,document=f3)
a.save()
os.remove(f2)
# job = myqueue(
# queuehigh,
# handle_zip_file,
# r.user.email,
# t,
# f2)
messages.info( messages.info(
request, request,