Merge tag 'stravafix' into develop
strava upload fix
This commit is contained in:
@@ -934,34 +934,31 @@ def workout_strava_upload_view(request,id=0):
|
||||
if (checkworkoutuser(request.user,w)):
|
||||
try:
|
||||
tcxfile = stravastuff.createstravaworkoutdata(w)
|
||||
except:
|
||||
with open("media/stravaerrors.log","a") as errorlog:
|
||||
errorstring = str(sys.exc_info()[0])
|
||||
timestr = time.strftime("%Y%m%d-%H%M%S")
|
||||
errorlog.write(timestr+errorstring+"\r\n")
|
||||
errorlog.write("views.py line 946\r\n")
|
||||
try:
|
||||
|
||||
with open(tcxfile,'rb') as f:
|
||||
try:
|
||||
res = stravastuff.handle_stravaexport(f,w.name,
|
||||
r.stravatoken,
|
||||
description=w.notes)
|
||||
except:
|
||||
w.uploadedtostrava = res
|
||||
w.save()
|
||||
os.remove(tcxfile)
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
successmessage = 'Workout sent to Strava.'
|
||||
except:
|
||||
with open("media/stravaerrors.log","a") as errorlog:
|
||||
errorstring = str(sys.exc_info()[0])
|
||||
timestr = time.strftime("%Y%m%d-%H%M%S")
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
errorlog.write(timestr+errorstring+"\r\n")
|
||||
errorlog.write("views.py line 946\r\n")
|
||||
message = 'Error: '+errorstring
|
||||
|
||||
|
||||
|
||||
w.uploadedtostrava = res
|
||||
w.save()
|
||||
os.remove(tcxfile)
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
successmessage = 'Workout sent to Strava.'
|
||||
url = reverse(workout_export_view,
|
||||
kwargs = {
|
||||
'id':str(w.id),
|
||||
'message':message,
|
||||
}
|
||||
)
|
||||
response = HttpResponseRedirect(url)
|
||||
@@ -973,7 +970,6 @@ def workout_strava_upload_view(request,id=0):
|
||||
url = reverse(workout_export_view,
|
||||
kwargs = {
|
||||
'id':str(w.id),
|
||||
'message':message,
|
||||
})
|
||||
response = HttpResponseRedirect(url)
|
||||
# except TimeoutExceeded as e:
|
||||
@@ -1014,7 +1010,7 @@ def workout_c2_upload_view(request,id=0):
|
||||
message = "Unexpected Error: "+str(sys.exc_info()[0])
|
||||
with open("media/c2errors.log","a") as errorlog:
|
||||
errorstring = str(sys.exc_info()[0])
|
||||
timestr = time.strftime("%Y%m%d-%H%M%S")
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
errorlog.write(timestr+errorstring+"\r\n")
|
||||
|
||||
# check for duplicate error first
|
||||
@@ -1034,7 +1030,7 @@ def workout_c2_upload_view(request,id=0):
|
||||
message = "Something went wrong in workout_c2_upload_view. Response code 200/201 but C2 sync failed: "+response.text
|
||||
with open("media/c2errors.log","a") as errorlog:
|
||||
errorstring = str(sys.exc_info()[0])
|
||||
timestr = time.strftime("%Y%m%d-%H%M%S")
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
errorlog.write(timestr+errorstring+"\r\n")
|
||||
|
||||
|
||||
@@ -1043,7 +1039,7 @@ def workout_c2_upload_view(request,id=0):
|
||||
message = "Something went wrong in workout_c2_upload_view. C2 sync failed."
|
||||
with open("media/c2errors.log","a") as errorlog:
|
||||
errorstring = str(sys.exc_info()[0])
|
||||
timestr = time.strftime("%Y%m%d-%H%M%S")
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
errorlog.write(timestr+errorstring+"\r\n")
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user