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

Side by Side Diff: chrome/common/extensions/docs/server/chromeextensionsdocs.py

Issue 5188003: Resolve relative paths to a hypothetical root before fetching docs from source control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/common/extensions/docs/server
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import cgi 6 import cgi
7 import logging 7 import logging
8 import re 8 import re
9 import os
9 10
10 from google.appengine.ext import webapp 11 from google.appengine.ext import webapp
11 from google.appengine.ext.webapp.util import run_wsgi_app 12 from google.appengine.ext.webapp.util import run_wsgi_app
12 from google.appengine.api import memcache 13 from google.appengine.api import memcache
13 from google.appengine.api import urlfetch 14 from google.appengine.api import urlfetch
14 15
15 # TODO(nickbaum): unit tests 16 # TODO(nickbaum): unit tests
16 17
17 18
18 # TODO(nickbaum): is this the right way to do constants? 19 # TODO(nickbaum): is this the right way to do constants?
(...skipping 17 matching lines...) Expand all
36 Channel.TRUNK = Channel("trunk", "") 37 Channel.TRUNK = Channel("trunk", "")
37 Channel.DEFAULT = Channel.STABLE 38 Channel.DEFAULT = Channel.STABLE
38 39
39 40
40 DEFAULT_CACHE_TIME = 300 41 DEFAULT_CACHE_TIME = 300
41 42
42 43
43 class MainPage(webapp.RequestHandler): 44 class MainPage(webapp.RequestHandler):
44 # get page from memcache, or else fetch it from src 45 # get page from memcache, or else fetch it from src
45 def get(self): 46 def get(self):
46 path = self.request.path 47 path = os.path.realpath(os.path.join('/', self.request.path))
47 # special path to invoke the unit tests 48 # special path to invoke the unit tests
48 # TODO(nickbaum): is there a less ghetto way to invoke the unit test? 49 # TODO(nickbaum): is there a less ghetto way to invoke the unit test?
49 if path == "/test/": 50 if path == "/test":
50 self.unitTest() 51 self.unitTest()
51 return 52 return
52 # if root, redirect to index.html 53 # if root, redirect to index.html
53 # TODO(nickbaum): this doesn't handle /chrome/extensions/trunk, etc 54 # TODO(nickbaum): this doesn't handle /chrome/extensions/trunk, etc
54 if (path == "/chrome/extensions") or (path == "chrome/extensions/"): 55 if (path == "/chrome/extensions") or (path == "chrome/extensions/"):
55 self.redirect("/chrome/extensions/index.html") 56 self.redirect("/chrome/extensions/index.html")
56 return 57 return
57 # else remove prefix 58 # else remove prefix
58 if(path[:18] == "/chrome/extensions"): 59 if(path[:18] == "/chrome/extensions"):
59 path = path[18:] 60 path = path[18:]
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 ('/.*', MainPage), 271 ('/.*', MainPage),
271 ], debug=False) 272 ], debug=False)
272 273
273 274
274 def main(): 275 def main():
275 run_wsgi_app(application) 276 run_wsgi_app(application)
276 277
277 278
278 if __name__ == '__main__': 279 if __name__ == '__main__':
279 main() 280 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698