From 84a83cab07853b83e91c40c440f65b911e3296a5 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Mon, 29 Apr 2013 07:37:38 -0500 Subject: Reports: Add support for Django 1.5 Signed-off-by: Sol Jerome --- src/lib/Bcfg2/Reporting/templatetags/syntax_coloring.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/lib/Bcfg2/Reporting/templatetags/syntax_coloring.py') diff --git a/src/lib/Bcfg2/Reporting/templatetags/syntax_coloring.py b/src/lib/Bcfg2/Reporting/templatetags/syntax_coloring.py index 2712d6395..22700689f 100644 --- a/src/lib/Bcfg2/Reporting/templatetags/syntax_coloring.py +++ b/src/lib/Bcfg2/Reporting/templatetags/syntax_coloring.py @@ -1,11 +1,8 @@ -import sys from django import template -from django.utils.encoding import smart_unicode +from django.utils.encoding import smart_str from django.utils.html import conditional_escape from django.utils.safestring import mark_safe -from Bcfg2.Compat import u_str - register = template.Library() # pylint: disable=E0611 @@ -33,9 +30,9 @@ def syntaxhilight(value, arg="diff", autoescape=None): if colorize: try: - output = u_str('') + output = smart_str('') lexer = get_lexer_by_name(arg) output += highlight(value, lexer, HtmlFormatter()) @@ -43,6 +40,7 @@ def syntaxhilight(value, arg="diff", autoescape=None): except: return value else: - return mark_safe(u_str('
Tip: Install pygments ' - 'for highlighting
%s
') % value) + return mark_safe(smart_str( + '
Tip: Install pygments ' + 'for highlighting
%s
') % value) syntaxhilight.needs_autoescape = True -- cgit v1.2.3-1-g7c22