summaryrefslogtreecommitdiffstats
path: root/core/views_caves.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views_caves.py')
-rw-r--r--core/views_caves.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/views_caves.py b/core/views_caves.py
index 946eba9..390d8f7 100644
--- a/core/views_caves.py
+++ b/core/views_caves.py
@@ -65,15 +65,16 @@ def getCave(cave_id):
are duplicates'''
try:
cave = Cave.objects.get(kataster_number=cave_id)
+ return cave
except Cave.MultipleObjectsReturned as ex:
raise MultipleObjectsReturned("Duplicate kataster number") from ex # propagate this up
- except Cave.DoesNotExist:
+ except Cave.DoesNotExist as ex:
Gcavelookup = GetCaveLookup() # dictionary makes strings to Cave objects
if cave_id in Gcavelookup:
return Gcavelookup[cave_id]
- else:
- raise ObjectDoesNotExist("No cave found with this identifier in any id field")
+ else:
+ raise ObjectDoesNotExist("No cave found with this identifier in any id field") from ex # propagate this up
except:
raise ObjectDoesNotExist("No cave found with this identifier in any id field")
@@ -144,6 +145,8 @@ def cave(request, cave_id='', offical_name=''):
return render(request, 'svxcaveseveral.html', {'settings': settings, "caves":caves }) # not the right template, needs a specific one
except ObjectDoesNotExist:
return render(request, 'svxcavesingle404.html', {'settings': settings, "cave":cave_id })
+ except:
+ return render(request, 'svxcavesingle404.html', {'settings': settings })
if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated():
return render(request, 'nonpublic.html', {'instance': cave, 'cavepage': True, 'cave_id': cave_id})