Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/handler.py |
| diff --git a/chrome/common/extensions/docs/server2/handler.py b/chrome/common/extensions/docs/server2/handler.py |
| index 2156c1630a07121066a0580512811318c05d2517..fe58d15b10007ca564e9f13f0d3b4302b1919c14 100644 |
| --- a/chrome/common/extensions/docs/server2/handler.py |
| +++ b/chrome/common/extensions/docs/server2/handler.py |
| @@ -4,8 +4,9 @@ |
| from branch_utility import BranchUtility |
| from cron_servlet import CronServlet |
| -from patch_servlet import PatchServlet |
| +from find_broken_links import CreateProcessor, FindBrokenLinks, usage |
| from instance_servlet import InstanceServlet |
| +from patch_servlet import PatchServlet |
| from servlet import Servlet, Request, Response |
| _SERVLETS = { |
| @@ -25,6 +26,27 @@ class Handler(Servlet): |
| return redirect |
| if path.startswith('_'): |
| + if path.startswith('_test_links'): |
| + seed_paths = ['/extensions/index.html', '/apps/about_apps.html'] |
| + output = [usage] |
| + |
| + # Functions to customize the behavior of the broken link finder. |
| + def writer(*args): |
| + output.append(' '.join([str(a) for a in args])) |
| + |
| + def renderer(path): |
| + return _DEFAULT_SERVLET( |
| + Request(path, self._request.host, self._request.headers)).Get() |
| + |
| + if '/' in path: |
| + channel = path.split('/')[1] |
| + if channel != 'stable': |
| + seed_paths = ['/%s%s' % (channel, p) for p in seed_paths] |
| + |
| + FindBrokenLinks(CreateProcessor(renderer), seed_paths, writer) |
| + |
| + return Response.Ok('\n'.join(output)) |
|
not at google - send to devlin
2013/07/01 23:16:21
This is kinda cool, I actually once did add a _tes
|
| + |
| servlet_path = path[1:] |
| if servlet_path.find('/') == -1: |
| servlet_path += '/' |