blob: 62b9c1f94eafabe6699c1f03744ae0f667628d4e [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001# Copyright 2016 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5"""Page class for generating somewhat informative project-page 404s.
6
7This page class produces a mostly-empty project subpage, which helps
8users find what they're looking for by providing navigational menus,
9rather than telling them "404. That's an error. That's all we know."
10which is maddeningly not helpful when we already have a project pb
11loaded.
12"""
13from __future__ import print_function
14from __future__ import division
15from __future__ import absolute_import
16
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020017from six.moves import http_client
Copybara854996b2021-09-07 19:36:02 +000018from framework import exceptions
19from framework import servlet
20
21
22class ErrorPage(servlet.Servlet):
23 """Page class for generating somewhat informative project-page 404s.
24
25 This page class produces a mostly-empty project subpage, which helps
26 users find what they're looking for by providing navigational menus,
27 rather than telling them "404. That's an error. That's all we know."
28 which is maddeningly not helpful when we already have a project pb
29 loaded.
30 """
31
32 _PAGE_TEMPLATE = 'sitewide/project-404-page.ezt'
33
34 def GatherPageData(self, mr):
35 """Build up a dictionary of data values to use when rendering the page."""
36 if not mr.project_name:
37 raise exceptions.InputException('No project specified')
38 return {
Adrià Vilanova Martínezde942802022-07-15 14:06:55 +020039 'http_response_code': http_client.NOT_FOUND,
40 }
41
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +010042 def Get404Page(self, **kwargs):
43 return self.handler(**kwargs)