2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

bug patch for duplicate SUrvexFile object

This commit is contained in:
Philip Sargent 2022-10-06 21:55:31 +03:00
parent 1f70b77735
commit d16226c879

View File

@ -171,8 +171,14 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
try: try:
sxpath = str(Path(sx).with_suffix('')) sxpath = str(Path(sx).with_suffix(''))
svxfile = SurvexFile.objects.get(path=sxpath) svxfile = SurvexFile.objects.get(path=sxpath)
except MultipleObjectsReturned:
# can happen if connecting a wallet to a survex file.. i think..
svxfiles = SurvexFile.objects.filter(path=sxpath)
for s in svxfiles:
print(s.path, s.cave, s.survexdirectory)
svxfile = svxfiles[0] # dont' know how this happened, fix later..
except: except:
file_complaint = f"{wallet} Survex file {sx} exists, but is not registered as imported via a *include {sxpath}." file_complaint = f"{wallet} Survex file {sx} exists, but is not registered in the database {sxpath}. How?.."
complaints.append(file_complaint) complaints.append(file_complaint)
message = f"! {file_complaint}" message = f"! {file_complaint}"
print(message) print(message)
@ -964,3 +970,4 @@ def dwgupload(request, folder=None, gitdisable='no'):
return render(request, 'dwguploadform.html', return render(request, 'dwguploadform.html',
{'form': form, 'doesnotexist': doesnotexist, 'urlfile': urlfile, 'urldir': urldir,'folder': folder, 'files': files, 'dirs': dirs, 'filesaved': filesaved, 'actual_saved': actual_saved, 'refused': refused}) {'form': form, 'doesnotexist': doesnotexist, 'urlfile': urlfile, 'urldir': urldir,'folder': folder, 'files': files, 'dirs': dirs, 'filesaved': filesaved, 'actual_saved': actual_saved, 'refused': refused})