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

Side by Side Diff: chrome/common/extensions/docs/server2/render_servlet.py

Issue 68873003: Docserver: Serve docs out of src/ not src/chrome/common/extensions. This allows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix samples Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from fnmatch import fnmatch 5 from fnmatch import fnmatch
6 import logging 6 import logging
7 import mimetypes 7 import mimetypes
8 import posixpath 8 import posixpath
9 import traceback 9 import traceback
10 from urlparse import urlsplit 10 from urlparse import urlsplit
11 11
12 from data_source_registry import CreateDataSources 12 from data_source_registry import CreateDataSources
13 from file_system import FileNotFoundError 13 from file_system import FileNotFoundError
14 from redirector import Redirector 14 from redirector import Redirector
15 from servlet import Servlet, Response 15 from servlet import Servlet, Response
16 from svn_constants import DOCS_PATH, PUBLIC_TEMPLATE_PATH
17 from third_party.handlebar import Handlebar 16 from third_party.handlebar import Handlebar
18 17
19 18
20 def _MakeHeaders(content_type): 19 def _MakeHeaders(content_type):
21 return { 20 return {
22 'X-Frame-Options': 'sameorigin', 21 'X-Frame-Options': 'sameorigin',
23 'Content-Type': content_type, 22 'Content-Type': content_type,
24 'Cache-Control': 'max-age=300', 23 'Cache-Control': 'max-age=300',
25 } 24 }
26 25
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 content = content_and_type.content 97 content = content_and_type.content
99 if isinstance(content, Handlebar): 98 if isinstance(content, Handlebar):
100 content = server_instance.template_renderer.Render(content, self._request) 99 content = server_instance.template_renderer.Render(content, self._request)
101 100
102 content_type = content_and_type.content_type 101 content_type = content_and_type.content_type
103 if isinstance(content, unicode): 102 if isinstance(content, unicode):
104 content = content.encode('utf-8') 103 content = content.encode('utf-8')
105 content_type += '; charset=utf-8' 104 content_type += '; charset=utf-8'
106 105
107 return Response.Ok(content, headers=_MakeHeaders(content_type)) 106 return Response.Ok(content, headers=_MakeHeaders(content_type))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698