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

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

Issue 67313008: Docserver: Fix 'encoding' typo; should have been 'charset'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 from svn_constants import DOCS_PATH, PUBLIC_TEMPLATE_PATH
17 from third_party.handlebar import Handlebar 17 from third_party.handlebar import Handlebar
18 18
19 19
20 def _MakeHeaders(content_type): 20 def _MakeHeaders(content_type):
21 return { 21 return {
22 'x-frame-options': 'sameorigin', 22 'X-Frame-Options': 'sameorigin',
23 'content-type': content_type, 23 'Content-Type': content_type,
24 'cache-control': 'max-age=300', 24 'Cache-Control': 'max-age=300',
25 } 25 }
26 26
27 27
28 class RenderServlet(Servlet): 28 class RenderServlet(Servlet):
29 '''Servlet which renders templates. 29 '''Servlet which renders templates.
30 ''' 30 '''
31 31
32 class Delegate(object): 32 class Delegate(object):
33 def CreateServerInstance(self): 33 def CreateServerInstance(self):
34 raise NotImplementedError(self.__class__) 34 raise NotImplementedError(self.__class__)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if not content_and_type.content: 95 if not content_and_type.content:
96 logging.error('%s had empty content' % path) 96 logging.error('%s had empty content' % path)
97 97
98 content = content_and_type.content 98 content = content_and_type.content
99 if isinstance(content, Handlebar): 99 if isinstance(content, Handlebar):
100 content = server_instance.template_renderer.Render(content, self._request) 100 content = server_instance.template_renderer.Render(content, self._request)
101 101
102 content_type = content_and_type.content_type 102 content_type = content_and_type.content_type
103 if isinstance(content, unicode): 103 if isinstance(content, unicode):
104 content = content.encode('utf-8') 104 content = content.encode('utf-8')
105 content_type += '; encoding=utf-8' 105 content_type += '; charset=utf-8'
106 106
107 return Response.Ok(content, headers=_MakeHeaders(content_type)) 107 return Response.Ok(content, headers=_MakeHeaders(content_type))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698