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

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

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: add executable bits for tests Created 7 years, 7 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
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from branch_utility import BranchUtility 5 from branch_utility import BranchUtility
6 from cron_servlet import CronServlet 6 from cron_servlet import CronServlet
7 from patch_servlet import PatchServlet
7 from instance_servlet import InstanceServlet 8 from instance_servlet import InstanceServlet
8 from servlet import Servlet, Request, Response 9 from servlet import Servlet, Request, Response
9 10
10 _SERVLETS = { 11 _SERVLETS = {
11 'cron': CronServlet, 12 'cron': CronServlet,
13 'patch': PatchServlet,
12 } 14 }
13 _DEFAULT_SERVLET = InstanceServlet.GetConstructor() 15 _DEFAULT_SERVLET = InstanceServlet.GetConstructor()
14 16
15 class Handler(Servlet): 17 class Handler(Servlet):
16 def Get(self): 18 def Get(self):
17 path = self._request.path 19 path = self._request.path
18 20
19 if path in ['favicon.ico', 'robots.txt']:
20 return Response.NotFound('')
21
22 redirect = self._RedirectSpecialCases() 21 redirect = self._RedirectSpecialCases()
23 if redirect is None: 22 if redirect is None:
24 redirect = self._RedirectFromCodeDotGoogleDotCom() 23 redirect = self._RedirectFromCodeDotGoogleDotCom()
25 if redirect is not None: 24 if redirect is not None:
26 return redirect 25 return redirect
27 26
28 if path.startswith('_'): 27 if path.startswith('_'):
29 servlet_path = path[1:] 28 servlet_path = path[1:]
30 if servlet_path.find('/') == -1: 29 if servlet_path.find('/') == -1:
31 servlet_path += '/' 30 servlet_path += '/'
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 62
64 new_path = path.split('/') 63 new_path = path.split('/')
65 if len(new_path) > 0 and new_path[0] == 'chrome': 64 if len(new_path) > 0 and new_path[0] == 'chrome':
66 new_path.pop(0) 65 new_path.pop(0)
67 for channel in BranchUtility.GetAllChannelNames(): 66 for channel in BranchUtility.GetAllChannelNames():
68 if channel in new_path: 67 if channel in new_path:
69 position = new_path.index(channel) 68 position = new_path.index(channel)
70 new_path.pop(position) 69 new_path.pop(position)
71 new_path.insert(0, channel) 70 new_path.insert(0, channel)
72 return Response.Redirect('/'.join([new_host] + new_path)) 71 return Response.Redirect('/'.join([new_host] + new_path))
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/fake_fetchers.py ('k') | chrome/common/extensions/docs/server2/instance_servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698