OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is govered 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 """A class to forward requests to the provided documentation url. |
| 7 |
| 8 This page handles the /wiki urls which are forwarded from Codesite. |
| 9 If a project has defined a docs_url, then the requests are forwarded there. |
| 10 If not, they are redirected to adminIntro. |
| 11 """ |
| 12 |
| 13 import httplib |
| 14 |
| 15 from framework import framework_helpers |
| 16 from framework import servlet |
| 17 from framework import urls |
| 18 |
| 19 |
| 20 class WikiRedirect(servlet.Servlet): |
| 21 """Redirect to the wiki documentation, if provided.""" |
| 22 |
| 23 def get(self, **kwargs): |
| 24 """Construct a 302 pointing at project.docs_url, or at adminIntro.""" |
| 25 docs_url = self.mr.project.docs_url |
| 26 if not docs_url: |
| 27 docs_url = framework_helpers.FormatAbsoluteURL( |
| 28 self.mr, urls.ADMIN_INTRO, include_project=True) |
| 29 self.response.location = docs_url |
| 30 self.response.status = httplib.MOVED_PERMANENTLY |
OLD | NEW |