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

Unified Diff: tools/json_schema_compiler/previewserver.py

Issue 10833024: Fix syntax highlighting in JSON Schema Compiler's preview server: don't crash (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/highlighters/pygments_highlighter.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/previewserver.py
diff --git a/tools/json_schema_compiler/previewserver.py b/tools/json_schema_compiler/previewserver.py
index 2d4105a99782929d645c5e35092f62b3242d3331..b965469a9a0a49554a691eb6c4101b7f677cf6a8 100755
--- a/tools/json_schema_compiler/previewserver.py
+++ b/tools/json_schema_compiler/previewserver.py
@@ -321,12 +321,19 @@ if __name__ == '__main__':
print('')
print(' http://localhost:%d/chrome/common/extensions/api' % opts.port)
print('')
- server = PreviewHTTPServer(('', int(opts.port)), CompilerHandler,
- {
- 'pygments': pygments_highlighter.PygmentsHighlighter(),
- 'hilite': hilite_me_highlighter.HiliteMeHighlighter(),
- 'none': none_highlighter.NoneHighlighter(),
- })
+
+ highlighters = {
+ 'hilite': hilite_me_highlighter.HiliteMeHighlighter(),
+ 'none': none_highlighter.NoneHighlighter()
+ }
+ try:
+ highlighters['pygments'] = pygments_highlighter.PygmentsHighlighter()
+ except ImportError as e:
+ pass
+
+ server = PreviewHTTPServer(('', int(opts.port)),
+ CompilerHandler,
+ highlighters)
server.serve_forever()
except KeyboardInterrupt:
server.socket.close()
« no previous file with comments | « tools/json_schema_compiler/highlighters/pygments_highlighter.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698