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

Unified 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: Additional information for broken anchor links Created 7 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 side-by-side diff with in-line comments
Download patch
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 += '/'

Powered by Google App Engine
This is Rietveld 408576698