Esempio n. 1
0
 def testGetChannelNameFromPath(self):
     b_util = BranchUtility(test_urlfetch)
     self.assertEquals(
         'dev', b_util.GetChannelNameFromPath('dev/hello/stuff.html'))
     self.assertEquals(
         'beta', b_util.GetChannelNameFromPath('beta/hello/stuff.html'))
     self.assertEquals(
         'trunk', b_util.GetChannelNameFromPath('trunk/hello/stuff.html'))
     self.assertEquals('stable',
                       b_util.GetChannelNameFromPath('hello/stuff.html'))
     self.assertEquals(
         'stable', b_util.GetChannelNameFromPath('hello/dev/stuff.html'))
Esempio n. 2
0
    def get(self):
        path = self.request.path.replace('/chrome/extensions/', '')

        parts = path.split('/')
        if len(parts) > 1:
            filename = parts[1]
        else:
            filename = parts[0]

        if len(path) > 0 and path[0] == '/':
            path = path.strip('/')

        fetcher = SubversionFetcher(urlfetch)
        b_util = BranchUtility(urlfetch)
        channel_name = b_util.GetChannelNameFromPath(path)
        branch = b_util.GetBranchNumberForChannelName(channel_name)

        logging.info(channel_name + ' ' + branch)
        try:
            result = fetcher.FetchResource(branch, EXTENSIONS_PATH + filename)
            content = result.content
            for key in result.headers:
                self.response.headers[key] = result.headers[key]
        except:
            content = 'File not found.'

        self.response.out.write(content)