Pygments 0.6 downgrade.

This commit is contained in:
Martin Mahner 2011-06-02 23:36:57 +02:00
parent 2734acb627
commit db0e060b30

View file

@ -1,7 +1,5 @@
from pygments.lexers import get_all_lexers, get_lexer_by_name, guess_lexer, PythonLexer
from pygments.styles import get_all_styles
from pygments.formatters import HtmlFormatter
from pygments.util import ClassNotFound
from pygments import highlight
from django.utils.html import escape
@ -41,7 +39,7 @@ class NakedHtmlFormatter(HtmlFormatter):
def pygmentize(code_string, lexer_name=LEXER_DEFAULT):
try:
lexer = get_lexer_by_name(lexer_name)
except ClassNotFound:
except ValueError:
logger.warning('Could not find lexer for name "%s"' % lexer_name)
lexer = PythonLexer()
@ -54,5 +52,5 @@ def pygmentize(code_string, lexer_name=LEXER_DEFAULT):
def guess_code_lexer(code_string, default_lexer='unknown'):
try:
return guess_lexer(code_string).name
except ClassNotFound:
except ValueError:
return default_lexer