From 4f161df1591959b6052ba966addfce88f84d3ab2 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Fri, 1 Jun 2007 04:03:56 -0400 Subject: falls through if pygments not detected --- bn_django/git_browse/views.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bn_django/git_browse') diff --git a/bn_django/git_browse/views.py b/bn_django/git_browse/views.py index 2722db2..e953d26 100644 --- a/bn_django/git_browse/views.py +++ b/bn_django/git_browse/views.py @@ -107,11 +107,12 @@ def view_commit(request, repo, hash): c = Commit(id=hash,repo=therepo) c.update() - from pygments import highlight - from pygments.lexers import DiffLexer - from pygments.formatters import HtmlFormatter - - c.pretty_diff = highlight(c.rawdiff, DiffLexer(), HtmlFormatter()) + try: + from pygments import highlight + from pygments.lexers import DiffLexer + from pygments.formatters import HtmlFormatter + c.pretty_diff = highlight(c.rawdiff, DiffLexer(), HtmlFormatter()) + except: pass return render_to_response('git_browse/commit.html', dict(object=therepo, heads=heads, tags=tags, -- cgit v1.2.3