[PATCH] pygmentsutils: don't fail if an extension doesn't speficy EXTRA_LEXERS

Andrew Shadura andrew at shadura.me
Tue Apr 4 14:55:42 UTC 2017


# HG changeset patch
# User Andrew Shadura <andrew at shadura.me>
# Date 1491317675 -7200
#      Tue Apr 04 16:54:35 2017 +0200
# Node ID 860e1f4e02146a9f5731ed426f6f36419e2f4110
# Parent  f58ed40c9a72ce0b72fa7ce4f8b7da843430bc57
pygmentsutils: don't fail if an extension doesn't speficy EXTRA_LEXERS

diff --git a/kallithea/lib/pygmentsutils.py b/kallithea/lib/pygmentsutils.py
--- a/kallithea/lib/pygmentsutils.py
+++ b/kallithea/lib/pygmentsutils.py
@@ -87,6 +87,6 @@ def get_custom_lexer(extension):
     """
     import kallithea
     #check if we didn't define this extension as other lexer
-    if kallithea.EXTENSIONS and extension in kallithea.EXTENSIONS.EXTRA_LEXERS:
+    if kallithea.EXTENSIONS and hasattr(kallithea.EXTENSIONS, 'EXTRA_LEXERS') and extension in kallithea.EXTENSIONS.EXTRA_LEXERS:
         _lexer_name = kallithea.EXTENSIONS.EXTRA_LEXERS[extension]
         return lexers.get_lexer_by_name(_lexer_name)


More information about the kallithea-general mailing list