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

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

Issue 17816005: Doc server broken link detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: finalization Created 7 years, 5 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 cron_servlet import CronServlet 5 from cron_servlet import CronServlet
6 from instance_servlet import InstanceServlet
6 from patch_servlet import PatchServlet 7 from patch_servlet import PatchServlet
7 from instance_servlet import InstanceServlet
8 from servlet import Servlet, Request, Response 8 from servlet import Servlet, Request, Response
9 9
10 _DEFAULT_SERVLET = InstanceServlet.GetConstructor() 10 _DEFAULT_SERVLET = InstanceServlet.GetConstructor()
11 _SERVLETS = { 11 _SERVLETS = {
12 'cron': CronServlet, 12 'cron': CronServlet,
13 'patch': PatchServlet, 13 'patch': PatchServlet,
14 } 14 }
15 15
16 class Handler(Servlet): 16 class Handler(Servlet):
17 def Get(self): 17 def Get(self):
18 path = self._request.path 18 path = self._request.path
19 19
20 if path.startswith('_'): 20 if path.startswith('_'):
21 servlet_path = path[1:] 21 servlet_path = path[1:]
22 if not '/' in servlet_path: 22 if not '/' in servlet_path:
23 servlet_path += '/' 23 servlet_path += '/'
24 servlet_name, servlet_path = servlet_path.split('/', 1) 24 servlet_name, servlet_path = servlet_path.split('/', 1)
25 servlet = _SERVLETS.get(servlet_name) 25 servlet = _SERVLETS.get(servlet_name)
26 if servlet is None: 26 if servlet is None:
27 return Response.NotFound('"%s" servlet not found' % servlet_path) 27 return Response.NotFound('"%s" servlet not found' % servlet_path)
28 else: 28 else:
29 servlet_path = path 29 servlet_path = path
30 servlet = _DEFAULT_SERVLET 30 servlet = _DEFAULT_SERVLET
31 31
32 return servlet( 32 return servlet(
33 Request(servlet_path, self._request.host, self._request.headers)).Get() 33 Request(servlet_path, self._request.host, self._request.headers)).Get()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/file_system_util.py ('k') | chrome/common/extensions/docs/server2/integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698