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

Side by Side Diff: chrome/common/extensions/docs/server2/echo_handler.py

Issue 10387225: Die build.py, Die: Part 1 (BranchUtility and SubversionFetcher) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Final changes Created 8 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import logging
7 import urlfetch
8
9 from google.appengine.ext import webapp
10 from google.appengine.ext.webapp.util import run_wsgi_app
11 from branch_utility import BranchUtility
12 from resource_fetcher import SubversionFetcher
13
14 EXTENSIONS_PATH = 'src/chrome/common/extensions/docs/'
15
16
17 class MainPage(webapp.RequestHandler):
18 def get(self):
19 path = self.request.path.replace('/chrome/extensions/', '')
20
21 parts = path.split('/')
22 if len(parts) > 1:
23 filename = parts[1]
24 else:
25 filename = parts[0]
26
27 if len(path) > 0 and path[0] == '/':
28 path = path.strip('/')
29
30 fetcher = SubversionFetcher(urlfetch)
31 b_util = BranchUtility(urlfetch)
32 channel_name = b_util.GetChannelNameFromPath(path)
33 branch = b_util.GetBranchNumberForChannelName(channel_name)
34
35 logging.info(channel_name + ' ' + branch)
36 try:
37 result = fetcher.FetchResource(branch, EXTENSIONS_PATH + filename)
38 content = result.content
39 for key in result.headers:
40 self.response.headers[key] = result.headers[key]
41 except:
42 content = 'File not found.'
43
44 self.response.out.write(content)
45
46 application = webapp.WSGIApplication([
47 ('/.*', MainPage),
48 ], debug=False)
49
50
51 def main():
52 run_wsgi_app(application)
53
54
55 if __name__ == '__main__':
56 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698