Index: chrome/common/extensions/docs/server2/render_servlet.py |
diff --git a/chrome/common/extensions/docs/server2/render_servlet.py b/chrome/common/extensions/docs/server2/render_servlet.py |
index 77944d7843346bf603e36ed4d2fcecb70c75f2d9..a910d03b91ef587ef710f7b07c552f9abff45508 100644 |
--- a/chrome/common/extensions/docs/server2/render_servlet.py |
+++ b/chrome/common/extensions/docs/server2/render_servlet.py |
@@ -11,6 +11,7 @@ from environment import IsPreviewServer |
from file_system import FileNotFoundError |
from redirector import Redirector |
from servlet import Servlet, Response |
+from special_paths import SITE_VERIFICATION_FILE |
from third_party.handlebar import Handlebar |
@@ -59,7 +60,7 @@ class RenderServlet(Servlet): |
path_components = path.split('/') |
for i in xrange(len(path_components) - 1, -1, -1): |
try: |
- path_404 = posixpath.join(*(path_components[0:i] + ['404.html'])) |
+ path_404 = posixpath.join(*(path_components[0:i] + ['404'])) |
response = self._GetSuccessResponse(path_404, server_instance) |
if response.status != 200: |
continue |
@@ -75,7 +76,7 @@ class RenderServlet(Servlet): |
raised, such that the only responses that will be returned from this method |
are Ok and Redirect. |
''' |
- content_provider, path = ( |
+ content_provider, serve_from, path = ( |
server_instance.content_providers.GetByServeFrom(path)) |
assert content_provider, 'No ContentProvider found for %s' % path |
@@ -87,7 +88,8 @@ class RenderServlet(Servlet): |
canonical_path = content_provider.GetCanonicalPath(path) |
if canonical_path != path: |
- return Response.Redirect('/' + canonical_path, permanent=False) |
+ redirect_path = posixpath.join(serve_from, canonical_path) |
+ return Response.Redirect('/' + redirect_path, permanent=False) |
content_and_type = content_provider.GetContentAndType(path).Get() |
if not content_and_type.content: |
@@ -97,11 +99,11 @@ class RenderServlet(Servlet): |
if isinstance(content, Handlebar): |
template_content, template_warnings = ( |
server_instance.template_renderer.Render(content, self._request)) |
- # HACK: the Google ID thing (google2ed...) doesn't have a title. |
+ # HACK: the site verification file (google2ed...) doesn't have a title. |
content, doc_warnings = server_instance.document_renderer.Render( |
template_content, |
path, |
- render_title=path != 'google2ed1af765c529f57.html') |
+ render_title=path != SITE_VERIFICATION_FILE) |
warnings = template_warnings + doc_warnings |
if warnings: |
sep = '\n - ' |