Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Bug 1272068 - Add a blanket 404 handler that does not echo the path
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche authored and jwhitlock committed Sep 9, 2020
1 parent 5cb8d2b commit 27fbb31
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ichnaea/content/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from pyramid.response import FileResponse
from pyramid.response import Response
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPNotFound

from ichnaea.conf import settings
from ichnaea.content.stats import global_stats, histogram, regions
Expand Down Expand Up @@ -306,6 +307,12 @@ def terms_of_service(self):
)
}

@view_config(context=HTTPNotFound)
def default_not_found(exc):
response = Response("<h1>404 Not Found</h1>")
response.status_int = 404
return response


def favicon_view(request):
return FileResponse(FAVICON_PATH, request=request)
Expand Down

0 comments on commit 27fbb31

Please sign in to comment.