background tasks must be able to accept jobkey keyword
This commit is contained in:
@@ -116,7 +116,7 @@ def handle_updatedps(useremail, workoutids, debug=False):
|
||||
def handle_sendemail_breakthrough(workoutid, useremail,
|
||||
userfirstname, userlastname,
|
||||
btvalues=pd.DataFrame().to_json(),
|
||||
debug=False):
|
||||
**kwargs):
|
||||
|
||||
# send email with attachment
|
||||
subject = "A breakthrough workout on rowsandall.com"
|
||||
@@ -176,7 +176,7 @@ def handle_sendemail_breakthrough(workoutid, useremail,
|
||||
def handle_sendemail_hard(workoutid, useremail,
|
||||
userfirstname, userlastname,
|
||||
btvalues=pd.DataFrame().to_json(),
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
|
||||
# send email with attachment
|
||||
subject = "That was a pretty hard workout on rowsandall.com"
|
||||
@@ -209,7 +209,7 @@ def handle_sendemail_hard(workoutid, useremail,
|
||||
# send email to me when an unrecognized file is uploaded
|
||||
@app.task
|
||||
def handle_sendemail_unrecognized(unrecognizedfile, useremail,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
|
||||
# send email with attachment
|
||||
fullemail = 'roosendaalsander@gmail.com'
|
||||
@@ -242,7 +242,7 @@ def handle_sendemail_unrecognized(unrecognizedfile, useremail,
|
||||
# send email to owner when an unrecognized file is uploaded
|
||||
@app.task
|
||||
def handle_sendemail_unrecognizedowner(useremail, userfirstname,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
|
||||
# send email with attachment
|
||||
fullemail = useremail
|
||||
@@ -273,7 +273,7 @@ def handle_sendemail_unrecognizedowner(useremail, userfirstname,
|
||||
|
||||
# Send email with TCX attachment
|
||||
@app.task
|
||||
def handle_sendemailtcx(first_name, last_name, email, tcxfile,debug=False):
|
||||
def handle_sendemailtcx(first_name, last_name, email, tcxfile,**kwargs):
|
||||
|
||||
# send email with attachment
|
||||
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
||||
@@ -296,8 +296,13 @@ def handle_sendemailtcx(first_name, last_name, email, tcxfile,debug=False):
|
||||
|
||||
|
||||
@app.task
|
||||
def handle_zip_file(emailfrom, subject, file,debug=False):
|
||||
def handle_zip_file(emailfrom, subject, file,**kwargs):
|
||||
message = "... zip processing ... "
|
||||
try:
|
||||
debug = kwargs['debug']
|
||||
except KeyError:
|
||||
debug = false
|
||||
|
||||
if debug:
|
||||
print message
|
||||
email = EmailMessage(subject, message,
|
||||
@@ -316,7 +321,7 @@ def handle_zip_file(emailfrom, subject, file,debug=False):
|
||||
|
||||
|
||||
@app.task
|
||||
def handle_sendemailcsv(first_name, last_name, email, csvfile,debug=False):
|
||||
def handle_sendemailcsv(first_name, last_name, email, csvfile,**kwargs):
|
||||
|
||||
# send email with attachment
|
||||
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
||||
@@ -473,7 +478,7 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
|
||||
|
||||
|
||||
@app.task
|
||||
def handle_updateergcp(rower_id,workoutfilenames,debug=False):
|
||||
def handle_updateergcp(rower_id,workoutfilenames,debug=False,**kwargs):
|
||||
therows = []
|
||||
for f1 in workoutfilenames:
|
||||
rowdata = rdata(f1)
|
||||
@@ -491,7 +496,7 @@ def handle_updateergcp(rower_id,workoutfilenames,debug=False):
|
||||
|
||||
|
||||
@app.task
|
||||
def handle_updatecp(rower_id,workoutids,debug=False,table='cpdata'):
|
||||
def handle_updatecp(rower_id,workoutids,debug=False,table='cpdata',**kwargs):
|
||||
columns = ['power','workoutid','time']
|
||||
df = getsmallrowdata_db(columns,ids=workoutids,debug=debug)
|
||||
dfgrouped = df.groupby(['workoutid'])
|
||||
@@ -512,7 +517,7 @@ def handle_updatecp(rower_id,workoutids,debug=False,table='cpdata'):
|
||||
|
||||
@app.task
|
||||
def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
|
||||
hrmax = hrdata['hrmax']
|
||||
hrut2 = hrdata['hrut2']
|
||||
@@ -585,7 +590,7 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_invite(email, name, code, teamname, manager,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = name + ' <' + email + '>'
|
||||
subject = 'Invitation to join team ' + teamname
|
||||
message = 'Dear ' + name + ',\n\n'
|
||||
@@ -627,7 +632,7 @@ def handle_sendemailnewresponse(first_name, last_name,
|
||||
commenter_last_name,
|
||||
comment,
|
||||
workoutname, workoutid, commentid,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = first_name + ' ' + last_name + ' <' + email + '>'
|
||||
subject = 'New comment on workout ' + workoutname
|
||||
message = 'Dear ' + first_name + ',\n\n'
|
||||
@@ -662,7 +667,7 @@ def handle_sendemailnewcomment(first_name,
|
||||
commenter_last_name,
|
||||
comment, workoutname,
|
||||
workoutid,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = first_name + ' ' + last_name + ' <' + email + '>'
|
||||
subject = 'New comment on workout ' + workoutname
|
||||
message = 'Dear ' + first_name + ',\n\n'
|
||||
@@ -686,7 +691,7 @@ def handle_sendemailnewcomment(first_name,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_request(email, name, code, teamname, requestor, id,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = name + ' <' + email + '>'
|
||||
subject = 'Request to join team ' + teamname
|
||||
message = 'Dear ' + name + ',\n\n'
|
||||
@@ -711,7 +716,7 @@ def handle_sendemail_request(email, name, code, teamname, requestor, id,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_request_accept(email, name, teamname, managername,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = name + ' <' + email + '>'
|
||||
subject = 'Welcome to ' + teamname
|
||||
message = 'Dear ' + name + ',\n\n'
|
||||
@@ -732,7 +737,7 @@ def handle_sendemail_request_accept(email, name, teamname, managername,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_request_reject(email, name, teamname, managername,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = name + ' <' + email + '>'
|
||||
subject = 'Your application to ' + teamname + ' was rejected'
|
||||
message = 'Dear ' + name + ',\n\n'
|
||||
@@ -754,7 +759,7 @@ def handle_sendemail_request_reject(email, name, teamname, managername,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_member_dropped(email, name, teamname, managername,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = name + ' <' + email + '>'
|
||||
subject = 'You were removed from ' + teamname
|
||||
message = 'Dear ' + name + ',\n\n'
|
||||
@@ -776,7 +781,7 @@ def handle_sendemail_member_dropped(email, name, teamname, managername,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_team_removed(email, name, teamname, managername,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = name + ' <' + email + '>'
|
||||
subject = 'Team ' + teamname + ' was deleted'
|
||||
message = 'Dear ' + name + ',\n\n'
|
||||
@@ -799,7 +804,7 @@ def handle_sendemail_team_removed(email, name, teamname, managername,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_invite_reject(email, name, teamname, managername,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = managername + ' <' + email + '>'
|
||||
subject = 'Your invitation to ' + name + ' was rejected'
|
||||
message = 'Dear ' + managername + ',\n\n'
|
||||
@@ -821,7 +826,7 @@ def handle_sendemail_invite_reject(email, name, teamname, managername,
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_invite_accept(email, name, teamname, managername,
|
||||
debug=False):
|
||||
debug=False,**kwargs):
|
||||
fullemail = managername + ' <' + email + '>'
|
||||
subject = 'Your invitation to ' + name + ' was accepted'
|
||||
message = 'Dear ' + managername + ',\n\n'
|
||||
@@ -838,5 +843,5 @@ def handle_sendemail_invite_accept(email, name, teamname, managername,
|
||||
|
||||
|
||||
# Another simple task for debugging purposes
|
||||
def add2(x, y,debug=False):
|
||||
def add2(x, y,debug=False,**kwargs):
|
||||
return x + y
|
||||
|
||||
Reference in New Issue
Block a user