Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2273)

Unified Diff: appengine/monorail/project/wikiredirect.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/project/test/projectupdates_test.py ('k') | appengine/monorail/proto/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/project/wikiredirect.py
diff --git a/appengine/monorail/project/wikiredirect.py b/appengine/monorail/project/wikiredirect.py
new file mode 100644
index 0000000000000000000000000000000000000000..0c323eb363806677618faf800dc830c9d9e3ab28
--- /dev/null
+++ b/appengine/monorail/project/wikiredirect.py
@@ -0,0 +1,30 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""A class to forward requests to the provided documentation url.
+
+This page handles the /wiki urls which are forwarded from Codesite.
+If a project has defined a docs_url, then the requests are forwarded there.
+If not, they are redirected to adminIntro.
+"""
+
+import httplib
+
+from framework import framework_helpers
+from framework import servlet
+from framework import urls
+
+
+class WikiRedirect(servlet.Servlet):
+ """Redirect to the wiki documentation, if provided."""
+
+ def get(self, **kwargs):
+ """Construct a 302 pointing at project.docs_url, or at adminIntro."""
+ docs_url = self.mr.project.docs_url
+ if not docs_url:
+ docs_url = framework_helpers.FormatAbsoluteURL(
+ self.mr, urls.ADMIN_INTRO, include_project=True)
+ self.response.location = docs_url
+ self.response.status = httplib.MOVED_PERMANENTLY
« no previous file with comments | « appengine/monorail/project/test/projectupdates_test.py ('k') | appengine/monorail/proto/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698