Fixed lexer key validation. Fixed tests.

This commit is contained in:
Martin Mahner 2014-03-13 15:55:27 +01:00
parent a3b8c8a7a7
commit bbd68ee2c9

View file

@ -1,7 +1,9 @@
from pygments import highlight from pygments import highlight
from pygments.lexers import * from pygments.lexers import *
from pygments.formatters import HtmlFormatter from pygments.formatters import HtmlFormatter
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext_lazy as _
""" """
# Get a list of all lexer, and then remove all lexer which have '-' or '+' # Get a list of all lexer, and then remove all lexer which have '-' or '+'
@ -25,7 +27,7 @@ LEXER_LIST = sorted(LEXER_LIST)
LEXER_LIST = getattr(settings, 'DPASTE_LEXER_LIST', ( LEXER_LIST = getattr(settings, 'DPASTE_LEXER_LIST', (
('text', 'Text'), ('text', 'Text'),
('code', 'Code'), ('code', 'Code'),
('Specific Code', ( (_('Specific Code'), (
('abap', 'ABAP'), ('abap', 'ABAP'),
('apacheconf', 'ApacheConf'), ('apacheconf', 'ApacheConf'),
('applescript', 'AppleScript'), ('applescript', 'AppleScript'),
@ -97,7 +99,7 @@ LEXER_LIST = getattr(settings, 'DPASTE_LEXER_LIST', (
)) ))
)) ))
LEXER_KEYS = dict(LEXER_LIST).keys() LEXER_KEYS = ['text', 'code'] + [i for i in dict(LEXER_LIST[2][1]).keys()]
# The default lexer is python # The default lexer is python
LEXER_DEFAULT = getattr(settings, 'DPASTE_LEXER_DEFAULT', 'python') LEXER_DEFAULT = getattr(settings, 'DPASTE_LEXER_DEFAULT', 'python')