Private
Public Access
1
0

removing some strava error catching code - I want tracebacks

This commit is contained in:
Sander Roosendaal
2017-02-17 07:37:31 +01:00
parent 5c81734d63
commit fd10f14660

View File

@@ -797,30 +797,21 @@ def workout_strava_upload_view(request,id=0):
tcxfile = stravastuff.createstravaworkoutdata(w) tcxfile = stravastuff.createstravaworkoutdata(w)
if tcxfile: if tcxfile:
with open(tcxfile,'rb') as f: with open(tcxfile,'rb') as f:
try: res = stravastuff.handle_stravaexport(f,w.name,
res = stravastuff.handle_stravaexport(f,w.name,
r.stravatoken, r.stravatoken,
description=w.notes) description=w.notes)
if res==0: if res==0:
message = "Strava Upload error: %s" % e message = "Strava Upload error: %s" % e
w.uploadedtostrava = -1 w.uploadedtostrava = -1
w.save() w.save()
os.remove(tcxfile) os.remove(tcxfile)
url = reverse(workout_export_view, url = reverse(workout_export_view,
kwargs = { kwargs = {
'id':str(w.id), 'id':str(w.id),
}) })
response = HttpResponseRedirect(url) response = HttpResponseRedirect(url)
return response return response
except:
with open("media/stravaerrors.log","a") as errorlog:
errorstring = str(sys.exc_info()[0])
timestr = strftime("%Y%m%d-%H%M%S")
errorlog.write(timestr+errorstring+"\r\n")
errorlog.write("views.py line 937\r\n")
message = 'Error: '+errorstring
res = 0
try: try:
w.uploadedtostrava = res w.uploadedtostrava = res
w.save() w.save()
@@ -832,7 +823,7 @@ def workout_strava_upload_view(request,id=0):
errorstring = str(sys.exc_info()[0]) errorstring = str(sys.exc_info()[0])
timestr = strftime("%Y%m%d-%H%M%S") timestr = strftime("%Y%m%d-%H%M%S")
errorlog.write(timestr+errorstring+"\r\n") errorlog.write(timestr+errorstring+"\r\n")
errorlog.write("views.py line 952\r\n") errorlog.write("views.py line 826\r\n")
message = 'Error: '+errorstring message = 'Error: '+errorstring
else: else:
message = "Strava Upload error" message = "Strava Upload error"