fix logging
This commit is contained in:
@@ -3720,7 +3720,6 @@ def handle_c2_async_workout(alldata, userid, c2token, c2id, delaysec,
|
|||||||
dologging('c2_import.log',
|
dologging('c2_import.log',
|
||||||
'Upload API returned status code {code}'.format(
|
'Upload API returned status code {code}'.format(
|
||||||
code=response.status_code))
|
code=response.status_code))
|
||||||
dologging('c2_import.log',json.dumps(response.data))
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
workoutid = response.json()['id']
|
workoutid = response.json()['id']
|
||||||
|
|||||||
@@ -5270,7 +5270,7 @@ def workout_upload_api(request):
|
|||||||
try:
|
try:
|
||||||
secret = post_data['secret']
|
secret = post_data['secret']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
dologging('c2_import.log','Missing credentials')
|
dologging('own_api.log','Missing credentials')
|
||||||
message = {'status': 'false', 'message': 'missing credentials'}
|
message = {'status': 'false', 'message': 'missing credentials'}
|
||||||
return JSONResponse(status=400, data=message)
|
return JSONResponse(status=400, data=message)
|
||||||
if secret != settings.UPLOAD_SERVICE_SECRET:
|
if secret != settings.UPLOAD_SERVICE_SECRET:
|
||||||
@@ -5292,11 +5292,11 @@ def workout_upload_api(request):
|
|||||||
f2 = 'media/'+f1
|
f2 = 'media/'+f1
|
||||||
copyfile(fstr, f2)
|
copyfile(fstr, f2)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
dologging('c2_import.log','no filename given')
|
dologging('own_api.log','no filename given')
|
||||||
message = {'status': 'false', 'message': 'no filename given'}
|
message = {'status': 'false', 'message': 'no filename given'}
|
||||||
return JSONResponse(status=400, data=message)
|
return JSONResponse(status=400, data=message)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
dologging('c2_import.log','could not find file')
|
dologging('own_api.log','could not find file')
|
||||||
message = {'status': 'false', 'message': 'could not find file'}
|
message = {'status': 'false', 'message': 'could not find file'}
|
||||||
return JSONResponse(status=400, data=message)
|
return JSONResponse(status=400, data=message)
|
||||||
|
|
||||||
@@ -5360,16 +5360,19 @@ def workout_upload_api(request):
|
|||||||
break
|
break
|
||||||
if r is not None and r.emailalternatives is not None:
|
if r is not None and r.emailalternatives is not None:
|
||||||
if post_data['useremail'] not in r.emailalternatives: # pragma: no cover
|
if post_data['useremail'] not in r.emailalternatives: # pragma: no cover
|
||||||
|
dologging('own_api.log','could not find user by email')
|
||||||
message = {'status': 'false',
|
message = {'status': 'false',
|
||||||
'message': 'could not find user'}
|
'message': 'could not find user'}
|
||||||
return JSONResponse(status=400, data=message)
|
return JSONResponse(status=400, data=message)
|
||||||
|
|
||||||
if r is None: # pragma: no cover
|
if r is None: # pragma: no cover
|
||||||
|
dologging('own_api.log','invalid user')
|
||||||
message = {'status': 'false', 'message': 'invalid user'}
|
message = {'status': 'false', 'message': 'invalid user'}
|
||||||
return JSONResponse(status=400, data=message)
|
return JSONResponse(status=400, data=message)
|
||||||
|
|
||||||
notes = form.cleaned_data['notes']
|
notes = form.cleaned_data['notes']
|
||||||
if optionsform.is_valid():
|
if optionsform.is_valid():
|
||||||
|
dologging('own_api.log','invalid options form')
|
||||||
make_plot = optionsform.cleaned_data['make_plot']
|
make_plot = optionsform.cleaned_data['make_plot']
|
||||||
plottype = optionsform.cleaned_data['plottype']
|
plottype = optionsform.cleaned_data['plottype']
|
||||||
makeprivate = optionsform.cleaned_data['makeprivate']
|
makeprivate = optionsform.cleaned_data['makeprivate']
|
||||||
@@ -5378,6 +5381,7 @@ def workout_upload_api(request):
|
|||||||
return JSONResponse(status=400, data=message)
|
return JSONResponse(status=400, data=message)
|
||||||
|
|
||||||
if r is None: # pragma: no cover
|
if r is None: # pragma: no cover
|
||||||
|
dologging('own_api.log','r is None')
|
||||||
message = {'status': 'false', 'message': 'something went wrong'}
|
message = {'status': 'false', 'message': 'something went wrong'}
|
||||||
return JSONResponse(status=400, data=message)
|
return JSONResponse(status=400, data=message)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user