summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-02-06 21:44:17 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-02-06 21:44:17 +0000
commita195b9bf6ca1713305f95a3db9d2c3352f568eba (patch)
tree75962a37ea9f3633ac5a08636d779a47b2b5fcc4 /src
parentb9645107c0409e666bb0d2c7af79e8304cf31c1e (diff)
downloadbcfg2-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')
-rw-r--r--src/lib/Server/Reports/reports/templatetags/syntax_coloring.py10
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)