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

Unified Diff: chrome/common/extensions/docs/server2/cron_servlet.py

Issue 148293018: Docserver: Make the .html extension unnecessary for content pages, for example, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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/cron_servlet.py
diff --git a/chrome/common/extensions/docs/server2/cron_servlet.py b/chrome/common/extensions/docs/server2/cron_servlet.py
index efdab71fa6c7af2f2a7368db1856c7c81899b02c..94792db9e628cde6f2d2e75a257a1d3c31b2f64c 100644
--- a/chrome/common/extensions/docs/server2/cron_servlet.py
+++ b/chrome/common/extensions/docs/server2/cron_servlet.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import logging
+import posixpath
import traceback
from app_yaml_helper import AppYamlHelper
@@ -21,6 +22,7 @@ from object_store_creator import ObjectStoreCreator
from render_servlet import RenderServlet
from server_instance import ServerInstance
from servlet import Servlet, Request, Response
+from special_paths import WEBMASTER_PROOF
from timer import Timer, TimerClosure
@@ -142,11 +144,18 @@ class CronServlet(Servlet):
delegate = _SingletonRenderServletDelegate(server_instance)
return RenderServlet(request, delegate).Get()
- def request_files_in_dir(path, prefix=''):
+ def request_files_in_dir(path, prefix='', strip_ext=None):
'''Requests every file found under |path| in this host file system, with
- a request prefix of |prefix|.
+ a request prefix of |prefix|. |strip_ext| is an optional list of file
+ extensions that should be stripped from paths before requesting.
'''
- files = [name for name, _ in CreateURLsFromPaths(trunk_fs, path, prefix)]
+ def maybe_strip_ext(name):
+ if name == WEBMASTER_PROOF or not strip_ext:
+ return name
+ base, ext = posixpath.splitext(name)
+ return base if ext in strip_ext else name
+ files = [maybe_strip_ext(name)
+ for name, _ in CreateURLsFromPaths(trunk_fs, path, prefix)]
return _RequestEachItem(path, files, render)
results = []
@@ -188,7 +197,8 @@ class CronServlet(Servlet):
# Rendering the public templates will also pull in all of the private
# templates.
- results.append(request_files_in_dir(PUBLIC_TEMPLATES))
+ results.append(request_files_in_dir(PUBLIC_TEMPLATES,
+ strip_ext=('.html', '.md')))
# Rendering the public templates will have pulled in the .js and
# manifest.json files (for listing examples on the API reference pages),

Powered by Google App Engine
This is Rietveld 408576698