Chromium Code Reviews| 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..9d40306faeefabf5eb5e65e00028148852d3194e 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): |
| @@ -180,6 +180,18 @@ class MainPage(webapp.RequestHandler): |
| return self.redirectToIndexIfNecessary() |
| + def redirectDomain(self): |
| + if (self.request.url.startswith('http://code.google.com')): |
| + 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, '') |
|
Aaron Boodman
2012/08/01 09:58:54
This is a little magical. Instead of adding the em
|
| + self.path.insert(1, channel) |
| + self.redirect(CHROME_DOMAIN_URL + '/'.join(self.path)) |
| + return False |
| + |
| + |
| def fetchContent(self): |
| logging.info("fetching: %s" % str((self.branch, self.docFamily, self.path))) |
| @@ -212,7 +224,8 @@ class MainPage(webapp.RequestHandler): |
| if (not self.initPath() or |
| not self.stripPathPrefix() or |
| not self.initChannel() or |
| - not self.initDocFamily()): |
| + not self.initDocFamily() or |
| + not self.redirectDomain()): |
| return |
| cacheKey = str((self.channel.name, self.docFamily, self.path)) |