Private
Public Access
1
0

adds testing of email

This commit is contained in:
Sander Roosendaal
2017-11-07 12:56:10 +01:00
parent 4f9539835f
commit e22e084552
24 changed files with 98177 additions and 29 deletions

View File

@@ -67,7 +67,7 @@ def rdata(file, rower=rrower()):
def make_new_workout_from_email(rower, datafile, name, cntr=0):
def make_new_workout_from_email(rower, datafile, name, cntr=0,testing=False):
""" This one is used in processemail """
workouttype = 'rower'
@@ -94,26 +94,28 @@ def make_new_workout_from_email(rower, datafile, name, cntr=0):
# with open('media/'+datafilename, 'r') as f_in, open(fcopy, 'w') as f_out:
# shutil.copyfileobj(f_in,f_out)
fcopy = "media/"+datafilename
if settings.DEBUG:
res = handle_sendemail_unrecognized.delay(
fcopy,
rower.user.email
)
res = handle_sendemail_unrecognizedowner.delay(
rower.user.email,
rower.user.first_name
if not testing:
if settings.DEBUG:
res = handle_sendemail_unrecognized.delay(
fcopy,
rower.user.email
)
res = handle_sendemail_unrecognizedowner.delay(
rower.user.email,
rower.user.first_name
)
else:
res = queuehigh.enqueue(handle_sendemail_unrecognized,
fcopy,
rower.user.email)
res = queuehigh.enqueue(handle_sendemail_unrecognizedowner,
rower.user.email,
rower.user.first_name
)
else:
res = queuehigh.enqueue(handle_sendemail_unrecognized,
fcopy,
rower.user.email)
res = queuehigh.enqueue(handle_sendemail_unrecognizedowner,
rower.user.email,
rower.user.first_name
)
return 0
summary = ''
# handle non-Painsled
if fileformat != 'csv':
filename_mediadir, summary, oarlength, inboard = dataprep.handle_nonpainsled(
@@ -159,4 +161,5 @@ def make_new_workout_from_email(rower, datafile, name, cntr=0):
notes='imported through email'
)
return id