Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # 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 | |
| 8 | This page class produces a mostly-empty project subpage, which helps |
| 9 | users find what they're looking for by providing navigational menus, |
| 10 | rather than telling them "404. That's an error. That's all we know." |
| 11 | which is maddeningly not helpful when we already have a project pb |
| 12 | loaded. |
| 13 | """ |
| 14 | from __future__ import print_function |
| 15 | from __future__ import division |
| 16 | from __future__ import absolute_import |
| 17 | |
| 18 | import httplib |
| 19 | from framework import exceptions |
| 20 | from framework import servlet |
| 21 | |
| 22 | |
| 23 | class 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 | } |