diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-02-06 21:44:17 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-02-06 21:44:17 +0000 |
commit | a195b9bf6ca1713305f95a3db9d2c3352f568eba (patch) | |
tree | 75962a37ea9f3633ac5a08636d779a47b2b5fcc4 /src/lib | |
parent | b9645107c0409e666bb0d2c7af79e8304cf31c1e (diff) | |
download | bcfg2-a195b9bf6ca1713305f95a3db9d2c3352f568eba.tar.gz bcfg2-a195b9bf6ca1713305f95a3db9d2c3352f568eba.tar.bz2 bcfg2-a195b9bf6ca1713305f95a3db9d2c3352f568eba.zip |
Fix reports system traceback (Resolves Ticket #387)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2794 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Reports/reports/templatetags/syntax_coloring.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/Server/Reports/reports/templatetags/syntax_coloring.py b/src/lib/Server/Reports/reports/templatetags/syntax_coloring.py index 14827b3c6..083b83a73 100644 --- a/src/lib/Server/Reports/reports/templatetags/syntax_coloring.py +++ b/src/lib/Server/Reports/reports/templatetags/syntax_coloring.py @@ -1,25 +1,25 @@ from django import template +register = template.Library() + try: from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatters import HtmlFormatter colorize = True + except: colorize = False - -register = template.Library() def syntaxhilight(value, arg="diff"): - '''Returns a syntax-hilighted version of Code; requires code and language arguments''' - lexer = get_lexer_by_name(arg) + '''Returns a syntax-hilighted version of Code; requires code/language arguments''' if colorize: try: + lexer = get_lexer_by_name(arg) return highlight(value, lexer, HtmlFormatter()) except: return value else: return value - register.filter('syntaxhilight', syntaxhilight) |