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 12521030: Extension docs: Include sidenav in 404 pages (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Extension docs: Include sidenav in 404 pages Created 7 years, 7 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 unified diff | Download patch
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 os 8 import os
9 import traceback 9 import traceback
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 content_type = mimetype 83 content_type = mimetype
84 elif path.endswith('.html'): 84 elif path.endswith('.html'):
85 content = templates.Render(path) 85 content = templates.Render(path)
86 content_type = 'text/html' 86 content_type = 'text/html'
87 except FileNotFoundError as e: 87 except FileNotFoundError as e:
88 logging.warning(traceback.format_exc()) 88 logging.warning(traceback.format_exc())
89 content = None 89 content = None
90 90
91 headers = {'x-frame-options': 'sameorigin'} 91 headers = {'x-frame-options': 'sameorigin'}
92 if content is None: 92 if content is None:
93 return Response.NotFound(templates.Render('404'), headers=headers) 93 doc_class = path.split('/', 1)[0]
94 content = templates.Render(doc_class + '/404')
95 if not content:
96 content = templates.Render('extensions/404')
97 if not content:
98 content = templates.Render('404')
not at google - send to devlin 2013/05/24 16:58:29 third branch here seems unnecessary. we should alw
方觉(Fang Jue) 2013/05/25 00:08:39 Yes. It's unnecessary. But before the new 404 temp
not at google - send to devlin 2013/05/28 14:53:37 Yes revision pinning works with branches too. Let'
99 return Response.NotFound(content, headers=headers)
94 100
95 if not content: 101 if not content:
96 logging.error('%s had empty content' % path) 102 logging.error('%s had empty content' % path)
97 103
98 headers.update({ 104 headers.update({
99 'content-type': content_type, 105 'content-type': content_type,
100 'cache-control': 'max-age=300', 106 'cache-control': 'max-age=300',
101 }) 107 })
102 return Response.Ok(content, headers=headers) 108 return Response.Ok(content, headers=headers)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698