Private
Public Access
1
0
This commit is contained in:
2024-08-06 20:28:10 +02:00
parent 97e8d1d6ea
commit fd895744db
6 changed files with 36 additions and 5 deletions

View File

@@ -434,7 +434,7 @@ def strokedata_tcx(request):
"""
if request.method != 'POST': # pragma: no cover
dologging('apilog.log','GET request to TCX endpoint')
return HttpResponseNotAllowed("Method not supported")
return HttpResponseNotAllowed("Method not supported")
if 'application/xml' not in request.content_type.lower(): # pragma: no cover
dologging('apilog.log','POST data not application/xml, request to TCX endpoint')

View File

@@ -812,8 +812,18 @@ def course_upload_view(request):
if f is not None:
filename, path_and_filename = handle_uploaded_file(f)
try:
cs = courses.kmltocourse(path_and_filename)
except ParseError:
os.remove(path_and_filename)
messages.error(
request, 'Something went wrong - error parsing the file')
url = reverse(course_upload_view)
cs = courses.kmltocourse(path_and_filename)
if is_ajax:
return JSONResponse({'result': 0, 'url': 0})
else:
return HttpResponseRedirect(url)
for course in cs:
cname = name+' - '+course['name']