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

Unified Diff: chrome/common/extensions/docs/server/main.py

Issue 10828221: Revert "Revert 149811 - adding redirect from codesite to chrome domain (bug 138776)" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « chrome/common/extensions/docs/server/app.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server/main.py
diff --git a/chrome/common/extensions/docs/server/main.py b/chrome/common/extensions/docs/server/main.py
index 854be76028e43537ba48f69fdade74d086e7de99..382ada49665eabdbbd8b61620272db3a41ad21e1 100755
--- a/chrome/common/extensions/docs/server/main.py
+++ b/chrome/common/extensions/docs/server/main.py
@@ -17,7 +17,7 @@ import app_known_issues
DEFAULT_CACHE_TIME = 300
VIEW_VC_ROOT = 'http://src.chromium.org'
-
+CHROME_DOMAIN_URL = 'http://developer.chrome.com'
class Channel():
def __init__(self, name, tag):
@@ -154,14 +154,6 @@ class MainPage(webapp.RequestHandler):
return self.redirectToIndexIfNecessary()
- def stripPathPrefix(self):
- # Remove chrome prefix if present. This happens in the case of
- # http://code.google.com/chrome/extensions/...
- if self.path[0:2] == ['chrome', 'extensions']:
- self.path = self.path[2:]
- return self.redirectToIndexIfNecessary()
-
-
def initChannel(self):
self.channel = GetChannelByName(self.path[0])
if self.channel is not None:
@@ -173,13 +165,26 @@ class MainPage(webapp.RequestHandler):
def initDocFamily(self):
if self.path[0] in ('extensions', 'apps'):
- self.docFamily = self.path[0]
- self.path.pop(0)
+ self.docFamily = self.path.pop(0)
else:
self.docFamily = 'extensions'
return self.redirectToIndexIfNecessary()
+ def redirectDomain(self):
+ if (self.request.url.startswith('http://code.google.com')):
+ self.path.pop(0) # 'chrome'
+ for channel in ['dev', 'beta', 'stable', 'trunk']:
+ if channel in self.path:
+ position = self.path.index(channel)
+ self.path.pop(position)
+ self.path.insert(0, channel)
+ self.redirect(CHROME_DOMAIN_URL + '/' + '/'.join(self.path), True)
+ return False
+ else:
+ return True
+
+
def fetchContent(self):
logging.info("fetching: %s" % str((self.branch, self.docFamily, self.path)))
@@ -210,7 +215,7 @@ class MainPage(webapp.RequestHandler):
def get(self):
if (not self.initPath() or
- not self.stripPathPrefix() or
+ not self.redirectDomain() or
not self.initChannel() or
not self.initDocFamily()):
return
« no previous file with comments | « chrome/common/extensions/docs/server/app.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698