Private
Public Access
1
0

added emailbounced keyword to tasks

This commit is contained in:
Sander Roosendaal
2018-03-18 09:55:49 +01:00
parent 4f1433830e
commit 77bb53466e
5 changed files with 242 additions and 66 deletions

View File

@@ -253,7 +253,7 @@ def handle_new_workout_from_file(r, f2,
@app.task
def handle_updatedps(useremail, workoutids, debug=False):
def handle_updatedps(useremail, workoutids, debug=False,**kwargs):
for wid, f1 in workoutids:
havedata = 1
try:
@@ -270,6 +270,7 @@ def handle_updatedps(useremail, workoutids, debug=False):
if havedata:
update_strokedata(wid, rowdata.df, debug=debug)
subject = "Rowsandall.com Your Distance per Stroke metric has been updated"
message = "All your workouts now have Distance per Stroke"
@@ -277,7 +278,13 @@ def handle_updatedps(useremail, workoutids, debug=False):
'Rowsandall <info@rowsandall.com>',
[useremail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -340,7 +347,15 @@ def handle_sendemail_breakthrough(workoutid, useremail,
'Rowsandall <info@rowsandall.com>',
[useremail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
# remove tcx file
return 1
@@ -380,7 +395,15 @@ def handle_sendemail_hard(workoutid, useremail,
'Rowsandall <info@rowsandall.com>',
[useremail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
# remove tcx file
return 1
@@ -400,7 +423,14 @@ def handle_sendemail_userdeleted(name, email, debug=False, **kwargs):
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -426,7 +456,14 @@ def handle_sendemail_unrecognized(unrecognizedfile, useremail,
except IOError:
pass
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
# remove tcx file
try:
@@ -464,7 +501,14 @@ def handle_sendemail_unrecognizedowner(useremail, userfirstname,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -486,7 +530,14 @@ def handle_sendemailtcx(first_name, last_name, email, tcxfile,**kwargs):
email.attach_file(tcxfile)
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
# remove tcx file
os.remove(tcxfile)
@@ -510,7 +561,16 @@ def handle_zip_file(emailfrom, subject, file,**kwargs):
email.attach_file(file)
if debug:
print "attaching"
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
if debug:
print "sent"
time.sleep(60)
@@ -541,7 +601,14 @@ def handle_sendemailsummary(first_name, last_name, email, csvfile, **kwargs):
email.attach_file(csvfile2)
os.remove(csvfile2)
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
try:
os.remove(csvfile)
except:
@@ -579,7 +646,14 @@ def handle_sendemailcsv(first_name, last_name, email, csvfile,**kwargs):
os.remove(csvfile2)
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -970,7 +1044,14 @@ def handle_sendemail_invite(email, name, code, teamname, manager,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1004,7 +1085,14 @@ def handle_sendemailnewresponse(first_name, last_name,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1034,7 +1122,14 @@ def handle_sendemailnewcomment(first_name,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1059,7 +1154,14 @@ def handle_sendemail_request(email, name, code, teamname, requestor, id,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1080,7 +1182,14 @@ def handle_sendemail_request_accept(email, name, teamname, managername,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1102,7 +1211,14 @@ def handle_sendemail_request_reject(email, name, teamname, managername,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1124,7 +1240,14 @@ def handle_sendemail_member_dropped(email, name, teamname, managername,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1147,7 +1270,14 @@ def handle_sendemail_team_removed(email, name, teamname, managername,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1169,7 +1299,14 @@ def handle_sendemail_invite_reject(email, name, teamname, managername,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1
@@ -1187,7 +1324,14 @@ def handle_sendemail_invite_accept(email, name, teamname, managername,
'Rowsandall <info@rowsandall.com>',
[fullemail])
res = email.send()
if 'emailbounced' in kwargs:
emailbounced = kwargs['emailbounced']
else:
emailbounced = False
if not emailbounced:
res = email.send()
return 1