# HG changeset patch # User Andrew Shadura # Date 2017-04-04 16:54:35 # Node ID f9b67a894e21d9f6241573e5b68813abce723cf9 # Parent 42bbccdec0a01e1a8b96b95880fb76b3da5135f6 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 @@ -86,7 +86,7 @@ def get_custom_lexer(extension): if there's no custom lexer defined """ import kallithea - #check if we didn't define this extension as other lexer - if kallithea.EXTENSIONS and extension in kallithea.EXTENSIONS.EXTRA_LEXERS: - _lexer_name = kallithea.EXTENSIONS.EXTRA_LEXERS[extension] - return lexers.get_lexer_by_name(_lexer_name) + lexer_name = getattr(kallithea.EXTENSIONS, 'EXTRA_LEXERS', {}).get(extension) + if lexer_name is None: + return None + return lexers.get_lexer_by_name(lexer_name)