blob: 397bd1d03e014fed118c71b24d15f830d520a308 [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
18import httplib
19from framework import exceptions
20from framework import servlet
21
22
23class ErrorPage(servlet.Servlet):
24 """Page class for generating somewhat informative project-page 404s.
25
26 This page class produces a mostly-empty project subpage, which helps
27 users find what they're looking for by providing navigational menus,
28 rather than telling them "404. That's an error. That's all we know."
29 which is maddeningly not helpful when we already have a project pb
30 loaded.
31 """
32
33 _PAGE_TEMPLATE = 'sitewide/project-404-page.ezt'
34
35 def GatherPageData(self, mr):
36 """Build up a dictionary of data values to use when rendering the page."""
37 if not mr.project_name:
38 raise exceptions.InputException('No project specified')
39 return {
40 'http_response_code': httplib.NOT_FOUND,
41 }