2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 14:07:15 +00:00

Bug: create year directory if a new year

This commit is contained in:
2025-02-17 21:32:31 +02:00
parent 95878e630d
commit 6c30a9ffcb

View File

@@ -311,7 +311,7 @@ def photoupload(request, folder=None):
if formd.is_valid(): if formd.is_valid():
newphotographer = sanitize_name(request.POST["photographer"]) newphotographer = sanitize_name(request.POST["photographer"])
try: try:
(yearpath / newphotographer).mkdir(exist_ok=True) (yearpath / newphotographer).mkdir(parents=True, exist_ok=True)
except: except:
message = f'\n !! Permissions failure ?! 0 attempting to mkdir "{(yearpath / newphotographer)}"' message = f'\n !! Permissions failure ?! 0 attempting to mkdir "{(yearpath / newphotographer)}"'
print(message) print(message)
@@ -453,10 +453,11 @@ def gpxupload(request, folder=None):
newprospector = sanitize_name(request.POST["prospector"]) newprospector = sanitize_name(request.POST["prospector"])
print(f"gpxupload() {newprospector=}") print(f"gpxupload() {newprospector=}")
try: try:
(yearpath / newprospector).mkdir(exist_ok=True) (yearpath / newprospector).mkdir(parents=True, exist_ok=True)
except: except:
message = f'\n !! Permissions failure ?! 0 attempting to mkdir "{(yearpath / newprospector)}"' message = f'\n !! Permissions failure ?! 0 attempting to mkdir "{(yearpath / newprospector)}"'
print(message) print(message)
raise
return render(request, "errors/generic.html", {"message": message}) return render(request, "errors/generic.html", {"message": message})
else: else: