replacing keyword async with harmless alternative
This commit is contained in:
@@ -439,14 +439,14 @@ def createstravaworkoutdata(w,dozip=True):
|
|||||||
# Upload the TCX file to Strava and set the workout activity type
|
# Upload the TCX file to Strava and set the workout activity type
|
||||||
# to rowing on Strava
|
# to rowing on Strava
|
||||||
def handle_stravaexport(f2,workoutname,stravatoken,description='',
|
def handle_stravaexport(f2,workoutname,stravatoken,description='',
|
||||||
activity_type='Rowing',async=False):
|
activity_type='Rowing',quick=False):
|
||||||
# w = Workout.objects.get(id=workoutid)
|
# w = Workout.objects.get(id=workoutid)
|
||||||
client = stravalib.Client(access_token=stravatoken)
|
client = stravalib.Client(access_token=stravatoken)
|
||||||
|
|
||||||
act = client.upload_activity(f2,'tcx.gz',name=workoutname)
|
act = client.upload_activity(f2,'tcx.gz',name=workoutname)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if async:
|
if quick:
|
||||||
res = act.wait(poll_interval=1.0, timeout=10)
|
res = act.wait(poll_interval=1.0, timeout=10)
|
||||||
message = 'Workout successfully synchronized to Strava'
|
message = 'Workout successfully synchronized to Strava'
|
||||||
else:
|
else:
|
||||||
@@ -625,7 +625,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
|||||||
|
|
||||||
return id,message
|
return id,message
|
||||||
|
|
||||||
def workout_strava_upload(user,w, async=False):
|
def workout_strava_upload(user,w, quick=False):
|
||||||
try:
|
try:
|
||||||
thetoken = strava_open(user)
|
thetoken = strava_open(user)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
@@ -648,7 +648,7 @@ def workout_strava_upload(user,w, async=False):
|
|||||||
f,w.name,
|
f,w.name,
|
||||||
r.stravatoken,
|
r.stravatoken,
|
||||||
description=w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
|
description=w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
|
||||||
activity_type=r.stravaexportas,async=async)
|
activity_type=r.stravaexportas,quick=quick)
|
||||||
if res==0:
|
if res==0:
|
||||||
message = mes
|
message = mes
|
||||||
w.uploadedtostrava = -1
|
w.uploadedtostrava = -1
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ def make_private(w,options):
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def do_sync(w,options, async=False):
|
def do_sync(w,options, quick=False):
|
||||||
try:
|
try:
|
||||||
upload_to_strava = options['upload_to_Strava']
|
upload_to_strava = options['upload_to_Strava']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -532,7 +532,7 @@ def do_sync(w,options, async=False):
|
|||||||
if ('upload_to_Strava' in options and upload_to_strava) or (w.user.strava_auto_export and ispromember(w.user.user)):
|
if ('upload_to_Strava' in options and upload_to_strava) or (w.user.strava_auto_export and ispromember(w.user.user)):
|
||||||
try:
|
try:
|
||||||
message,id = stravastuff.workout_strava_upload(
|
message,id = stravastuff.workout_strava_upload(
|
||||||
w.user.user,w,async=async
|
w.user.user,w,quick=quick
|
||||||
)
|
)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
id = 0
|
id = 0
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ def workout_strava_upload_view(request,id=0):
|
|||||||
f,w.name,
|
f,w.name,
|
||||||
r.stravatoken,
|
r.stravatoken,
|
||||||
description=newnotes,
|
description=newnotes,
|
||||||
activity_type=activity_type,async=False)
|
activity_type=activity_type,quick=False)
|
||||||
if res==0:
|
if res==0:
|
||||||
messages.error(request,mes)
|
messages.error(request,mes)
|
||||||
w.uploadedtostrava = -1
|
w.uploadedtostrava = -1
|
||||||
|
|||||||
@@ -4500,7 +4500,7 @@ def workout_upload_api(request):
|
|||||||
|
|
||||||
w = Workout.objects.get(id=id)
|
w = Workout.objects.get(id=id)
|
||||||
|
|
||||||
uploads.do_sync(w,post_data,async=True)
|
uploads.do_sync(w,post_data,quick=True)
|
||||||
|
|
||||||
if make_plot:
|
if make_plot:
|
||||||
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||||
|
|||||||
Reference in New Issue
Block a user