From 79a9821a4f6d55ccede041b39993db0df13a4cff Mon Sep 17 00:00:00 2001 From: Dustin Wyatt Date: Wed, 18 Oct 2017 11:43:47 -0500 Subject: [PATCH] Add import for TextLexer. If pygments did not recognize the language name it was being passed, this would raise a `NameError` because `TextLexer` import was missing. --- rest_framework/compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index c0aa1d2fc1..5c623dcbf5 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -213,7 +213,7 @@ def apply_markdown(text): try: import pygments - from pygments.lexers import get_lexer_by_name + from pygments.lexers import get_lexer_by_name, TextLexer from pygments.formatters import HtmlFormatter def pygments_highlight(text, lang, style):