Private
Public Access
1
0
This commit is contained in:
2024-11-11 10:19:08 +01:00
parent 90be8e5030
commit 8d64c60b49
3 changed files with 5 additions and 2 deletions

View File

@@ -469,7 +469,10 @@ def strokedata_tcx(request):
if request.data:
tcxdata = request.data
tcxfilename = 'media/{code}.tcx'.format(code=uuid4().hex[:16])
xml_string = ET.tostring(tcxdata, encoding='utf-8', method='xml').decode('utf-8')
try:
xml_string = ET.tostring(tcxdata, encoding='utf-8', method='xml').decode('utf-8')
except AttributeError:
return HttpResponseNotAllowed("Could not parse TCX data")
with open(tcxfilename, 'w', encoding='utf-8') as xml_file:
xml_file.write(xml_string)