OLD | NEW |
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 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if not content_and_type.content: | 96 if not content_and_type.content: |
97 logging.error('%s had empty content' % path) | 97 logging.error('%s had empty content' % path) |
98 | 98 |
99 content = content_and_type.content | 99 content = content_and_type.content |
100 if isinstance(content, Handlebar): | 100 if isinstance(content, Handlebar): |
101 # HACK: the Google ID thing (google2ed...) doesn't have a title. | 101 # HACK: the Google ID thing (google2ed...) doesn't have a title. |
102 content, warnings = server_instance.document_renderer.Render( | 102 content, warnings = server_instance.document_renderer.Render( |
103 server_instance.template_renderer.Render(content, self._request), | 103 server_instance.template_renderer.Render(content, self._request), |
104 render_title=path != 'google2ed1af765c529f57.html') | 104 render_title=path != 'google2ed1af765c529f57.html') |
105 if warnings: | 105 if warnings: |
106 logging.warning('\n'.join(warnings)) | 106 sep = '\n - ' |
| 107 logging.warning('Rendering %s:%s%s' % (path, sep, sep.join(warnings))) |
107 | 108 |
108 content_type = content_and_type.content_type | 109 content_type = content_and_type.content_type |
109 if isinstance(content, unicode): | 110 if isinstance(content, unicode): |
110 content = content.encode('utf-8') | 111 content = content.encode('utf-8') |
111 content_type += '; charset=utf-8' | 112 content_type += '; charset=utf-8' |
112 | 113 |
113 return Response.Ok(content, headers=_MakeHeaders(content_type)) | 114 return Response.Ok(content, headers=_MakeHeaders(content_type)) |
OLD | NEW |