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