Exemple #1
0
def _MakeChannelDict(channel_name):
  channel_dict = {
    'channels': [{'name': name} for name in BranchUtility.GetAllBranchNames()],
    'current': channel_name
  }
  for channel in channel_dict['channels']:
    if channel['name'] == channel_name:
      channel['isCurrent'] = True
  return channel_dict
Exemple #2
0
    def _RedirectFromCodeDotGoogleDotCom(self, path):
        if (not self.request.url.startswith(
            ('http://code.google.com', 'https://code.google.com'))):
            return False

        new_url = 'http://developer.chrome.com/'

        # switch to https if necessary
        if (self.request.url.startswith('https')):
            new_url = new_url.replace('http', 'https', 1)

        path = path.split('/')
        if len(path) > 0 and path[0] == 'chrome':
            path.pop(0)
        for channel in BranchUtility.GetAllBranchNames():
            if channel in path:
                position = path.index(channel)
                path.pop(position)
                path.insert(0, channel)
        new_url += '/'.join(path)
        self.redirect(new_url)
        return True