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

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: yoz 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 99b93b7a859a4ecbaa3b24f3314ec774949e8821..8bfb5285a2717375dde317b5615e212b88ff7bbe 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
@@ -22,6 +23,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 SITE_VERIFICATION_FILE
from timer import Timer, TimerClosure
@@ -146,11 +148,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 == SITE_VERIFICATION_FILE 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 = []
@@ -192,7 +201,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),
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | chrome/common/extensions/docs/server2/integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698