diff --git a/core/views/caves.py b/core/views/caves.py
index 305aabb..2ec7935 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -276,14 +276,18 @@ def cave(request, cave_id='', offical_name=''):
caves = Cave.objects.filter(kataster_number=cave_id)
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 })
+ return render(request, 'errors/svxcavesingle404.html', {'settings': settings, "cave":cave_id })
except:
- return render(request, 'svxcavesingle404.html', {'settings': settings })
+ return render(request, 'errors/svxcavesingle404.html', {'settings': settings })
return rendercave(request, cave, cave.slug(), cave_id=cave_id)
def caveEntrance(request, slug):
- cave = Cave.objects.get(caveslug__slug = slug)
+ try:
+ cave = Cave.objects.get(caveslug__slug = slug)
+ except:
+ return render(request,'errors/badslug.html', {'badslug': slug})
+
if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated:
return render(request,'nonpublic.html', {'instance': cave})
else:
diff --git a/templates/errors/badslug.html b/templates/errors/badslug.html
new file mode 100644
index 0000000..bd507fa
--- /dev/null
+++ b/templates/errors/badslug.html
@@ -0,0 +1,63 @@
+{% extends 'base.html' %}
+
+{% block title %}Troggle Error - Bad Slug{% endblock %}
+{% block content %}
+
+
+
Bad Slug Error
+
+
+
+
+
+
+
There has been a Troggle error.
+
+ A Cave or an Entrance has been referred to using a label (a 'slug') which does not work.
+
This is the bad slug:
+
+
+ {% if badslug %}
+ {{badslug}}
+ {% else %}
+ We are terribly sorry but a fault has occurred. Something in the system is referring to something else which does not exist.
+
+ {% endif %}
+
+
+ This is the previous page which had the bad slug reference on it:
+
+
+
+
+
It is also possible that the cave description page is being viewed using an alternative URL,
+so that the local links in the page to other parts of the cave do not work.
+
+e.g. /cave/1623-161 is not the correct way of looking at Kaninchenhohle,
+
+you should be using
+/1623/161/top.htm instead.
+
If that is the case, tell a nerd that we haven't fixed the fault that we thought we had fixed.
+
+
+
+
What you should do now
+
Please report the error by emailing the nerds at
+ expo-tech@lists.wookware.org with this information:
+
+ - The bad slug text written in red above.
+
- The previous page URL, also written in red above
+
- Go back to this previous page
+ and see if you can tell whether the bad slug was in HTML text which had been written manually, or whether it appeared to be a programming error.
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/errors/generic.html b/templates/errors/generic.html
index 19bed46..0f2e876 100644
--- a/templates/errors/generic.html
+++ b/templates/errors/generic.html
@@ -1,35 +1,48 @@
{% extends 'base.html' %}
-{% block title %}Website Error - {% endblock %}
+{% block title %}Troggle Error - Generic{% endblock %}
{% block content %}
-
Website Error
+ Troggle Error
-
-
+
-
There has been an error.
-
-
+
There has been an error. This is either bad data or a bug in the software.
+
+
{% if message %}
{{message}}
{% else %}
We are terribly sorry but an unknown fault has occurred.
- {% endif %})
+ {% endif %}
+
+
+
+
+
What you should do now
+
Please report the error by emailing the nerds at
+ expo-tech@lists.wookware.org with this information:
+
+ - The error message written in red above.
+
- The previous page URL:
+
+
- Go back to this previous page
+ and see if you can tell whether the bad page reference was in HTML text which had been written manually, or whether it appeared to be a programming error.
+
-
-
-
-
{% endblock %}
\ No newline at end of file
diff --git a/templates/errors/svxcavesingle404.html b/templates/errors/svxcavesingle404.html
new file mode 100644
index 0000000..81e82fa
--- /dev/null
+++ b/templates/errors/svxcavesingle404.html
@@ -0,0 +1,52 @@
+
+{% extends "base.html" %}
+{% block title %}Troggle Error - Bad Cave ID{% endblock %}
+
+{% block content %}
+
+
Cave Identifier not found in database
+
+
Cave identifier looked for: '{{cave}}'
+
+- - unofficial number like this not found
+- - kataster number like this not found
+
+
+
You probably got here because a survex (.svx) file has been stored on the server in the
+:loser: repository
+but whoever was
+responsible has not yet created the appropriate XML file the
+:expoweb: repository
+which registers the cave description and ties together
+the survex files with everything else.
+
+
+
The process for registering a new cave is documented in
+this part of the survey handbook.
+
+
It is also possible that the cave description page is being viewed using an alternative URL,
+so that the local links in the page to other parts of the cave do not work.
+
+e.g. /cave/1623-161 is not the correct way of looking at Kaninchenhohle,
+
+you should be using
+/1623/161/top.htm instead.
+
If that is the case, tell a nerd that we haven't fixed the fault that we thought we had fixed.
+
+
+
What you should do now
+
Please report the error by emailing the nerds at
+ expo-tech@lists.wookware.org with this information:
+
+ - The error message written in red above.
+
- The previous page URL:
+
+
- Go back to this previous page
+ and see if you can tell whether the bad page reference was in HTML text which had been written manually, or whether it appeared to be a programming error.
+
+
+{% endblock %}
diff --git a/templates/svxcavesingle404.html b/templates/svxcavesingle404.html
deleted file mode 100644
index 2438685..0000000
--- a/templates/svxcavesingle404.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-{% extends "base.html" %}
-{% block title %}List of survex files{% endblock %}
-
-{% block content %}
-
-
Cave not found in database
-
-
Cave number looked for: '{{cave}}'
-
-- - unofficial number like this not found
-- - kataster number like this not found
-
-
-
You probably got here because a survex (.svx) file has been stored on the server in the
-:loser: repository
-but whoever was
-responsible has not yet created the appropriate XML file the
-:expoweb: repository
-which registers the cave description and ties together
-the survex files with everything else.
-
-
-
The process for registering a new cave is documented in
-this part of the survey handbook.
-
-{% endblock %}
diff --git a/urls.py b/urls.py
index 49406e0..3c8cc19 100644
--- a/urls.py
+++ b/urls.py
@@ -121,14 +121,14 @@ trogglepatterns = [
re_path(r'^cave/3d/(?P[^/]+)$', caves.cave3d, name="cave3d"),
re_path(r'^cave/description/([^/]+)/?$', caves.caveDescription),
- re_path(r'^cave/(?P[^/]+)/?$', caves.cave, name="cave"),
+ re_path(r'^cave/(?P[^/]+)/?$', caves.cave, name="cave"), #!!!BAD, local links fail
re_path(r'^cave/(?P[^/]+)/?(?P[^/])$', ent), # view_caves.ent
re_path(r'^cave/(?P[^/]+)/edit/$', caves.edit_cave, name="edit_cave"),
re_path(r'^(?P\d\d\d\d)(?P.*)$', cavepage, name="cavepage"), # shorthand /1623/264 BUT url links may break
# Note that urls eg '1623/161/l/rl89a.htm' are handled by cavepage which redirects them to 'expopage'
# Entrances
- re_path(r'^cave/entrance/([^/]+)/?$', caves.caveEntrance), # lists all entrances
+ re_path(r'^cave/entrance/([^/]+)/?$', caves.caveEntrance), # lists all entrances !!!BAD, local links fail
re_path(r'^entrance/(?P[^/]+)/(?P[^/]+)/edit/', caves.edit_entrance, name = "editentrance"), #edit existing entrance
re_path(r'^entrance/new/(?P[^/]+)$', caves.edit_entrance, name = "newentrance"), # new entrance for a cave