OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 mimetypes | 6 import mimetypes |
7 import os | 7 import os |
8 | 8 |
9 from file_system import FileNotFoundError | 9 from file_system import FileNotFoundError |
10 import compiled_file_system as compiled_fs | 10 import compiled_file_system as compiled_fs |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 elif path.startswith('static/'): | 64 elif path.startswith('static/'): |
65 content = self._FetchStaticResource(path, response) | 65 content = self._FetchStaticResource(path, response) |
66 elif path.endswith('.html'): | 66 elif path.endswith('.html'): |
67 content = templates.Render(path) | 67 content = templates.Render(path) |
68 | 68 |
69 response.headers['x-frame-options'] = 'sameorigin' | 69 response.headers['x-frame-options'] = 'sameorigin' |
70 if content: | 70 if content: |
71 response.headers['cache-control'] = 'max-age=300' | 71 response.headers['cache-control'] = 'max-age=300' |
72 response.out.write(content) | 72 response.out.write(content) |
73 else: | 73 else: |
74 response.set_status(404); | 74 response.set_status(404) |
75 response.out.write(templates.Render('404')) | 75 doc_class = path.split('/', 1)[0] |
| 76 content = templates.Render(doc_class + '/404') |
| 77 if not content: |
| 78 content = templates.Render('extensions/404') |
| 79 response.out.write(content) |
OLD | NEW |