Commit e5a57b68 authored by aa@chromium.org's avatar aa@chromium.org

Revert "Revert 149811 - adding redirect from codesite to chrome domain (bug 138776)"

This reverts commit 77592af8b97f753a7b2540e613166759c6fc314c.

TBR=yoz@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10828221

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150810 0039d316-1c4b-4281-b951-d872f2087c98
parent 0f5b6ccb
application: chrome-apps-doc application: chrome-apps-doc
version: 1-2-5 version: 1-2-6
runtime: python runtime: python
api_version: 1 api_version: 1
......
...@@ -17,7 +17,7 @@ import app_known_issues ...@@ -17,7 +17,7 @@ import app_known_issues
DEFAULT_CACHE_TIME = 300 DEFAULT_CACHE_TIME = 300
VIEW_VC_ROOT = 'http://src.chromium.org' VIEW_VC_ROOT = 'http://src.chromium.org'
CHROME_DOMAIN_URL = 'http://developer.chrome.com'
class Channel(): class Channel():
def __init__(self, name, tag): def __init__(self, name, tag):
...@@ -154,14 +154,6 @@ class MainPage(webapp.RequestHandler): ...@@ -154,14 +154,6 @@ class MainPage(webapp.RequestHandler):
return self.redirectToIndexIfNecessary() 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): def initChannel(self):
self.channel = GetChannelByName(self.path[0]) self.channel = GetChannelByName(self.path[0])
if self.channel is not None: if self.channel is not None:
...@@ -173,13 +165,26 @@ class MainPage(webapp.RequestHandler): ...@@ -173,13 +165,26 @@ class MainPage(webapp.RequestHandler):
def initDocFamily(self): def initDocFamily(self):
if self.path[0] in ('extensions', 'apps'): if self.path[0] in ('extensions', 'apps'):
self.docFamily = self.path[0] self.docFamily = self.path.pop(0)
self.path.pop(0)
else: else:
self.docFamily = 'extensions' self.docFamily = 'extensions'
return self.redirectToIndexIfNecessary() 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): def fetchContent(self):
logging.info("fetching: %s" % str((self.branch, self.docFamily, self.path))) logging.info("fetching: %s" % str((self.branch, self.docFamily, self.path)))
...@@ -210,7 +215,7 @@ class MainPage(webapp.RequestHandler): ...@@ -210,7 +215,7 @@ class MainPage(webapp.RequestHandler):
def get(self): def get(self):
if (not self.initPath() or if (not self.initPath() or
not self.stripPathPrefix() or not self.redirectDomain() or
not self.initChannel() or not self.initChannel() or
not self.initDocFamily()): not self.initDocFamily()):
return return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment