Private
Public Access
1
0

works but runs into email rate limiting

This commit is contained in:
Sander Roosendaal
2017-04-14 08:57:46 +02:00
parent 34b5d420ee
commit 5bc69b3a49
5 changed files with 352 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ from rowers.models import Workout, User, Rower,StrokeData
from rowingdata import rowingdata as rrdata
from rowers.tasks import handle_sendemail_unrecognized
from rowers.tasks import handle_zip_file
from rowingdata import rower as rrower
from rowingdata import main as rmain
@@ -44,7 +45,7 @@ import sys
import django_rq
queue = django_rq.get_queue('default')
queuelow = django_rq.get_queue('low')
queuehigh = django_rq.get_queue('low')
queuehigh = django_rq.get_queue('default')
user = settings.DATABASES['default']['USER']
@@ -573,17 +574,26 @@ def new_workout_from_file(r,f2,
if len(fileformat)==3 and fileformat[0]=='zip':
f_to_be_deleted = f2
with zipfile.ZipFile(f2) as z:
# for now, we're getting only the first file
# from the NK zip file (issue #69 on bitbucket)
for fname in z.namelist():
f3 = z.extract(fname,path='media/')
id,message,f2 = new_workout_from_file(r,f3,
workouttype=workouttype,
makeprivate=makeprivate,
title = title,
notes='')
print f3,r.user.email,title
if settings.DEBUG:
res = handle_zip_file.delay(
r.user.email,title,f3
)
else:
res = queuelow.enqueue(
handle_zip_file,
r.user.email,
title,
f3
)
os.remove(f_to_be_deleted)
return id,message,f2
return -1,message,f2
# Some people try to upload Concept2 logbook summaries
if fileformat == 'c2log':