##// END OF EJS Templates
lazy load pygments lib so we can use VCS without it installed
marcink -
r3876:c5dd289c beta
parent child Browse files
Show More
@@ -13,8 +13,6 b' import stat'
13 import posixpath
13 import posixpath
14 import mimetypes
14 import mimetypes
15
15
16 from pygments import lexers
17
18 from rhodecode.lib.vcs.backends.base import EmptyChangeset
16 from rhodecode.lib.vcs.backends.base import EmptyChangeset
19 from rhodecode.lib.vcs.exceptions import NodeError, RemovedFileNodeError
17 from rhodecode.lib.vcs.exceptions import NodeError, RemovedFileNodeError
20 from rhodecode.lib.vcs.utils.lazy import LazyProperty
18 from rhodecode.lib.vcs.utils.lazy import LazyProperty
@@ -360,7 +358,7 b' class FileNode(Node):'
360 Returns pygment's lexer class. Would try to guess lexer taking file's
358 Returns pygment's lexer class. Would try to guess lexer taking file's
361 content, name and mimetype.
359 content, name and mimetype.
362 """
360 """
363
361 from pygments import lexers
364 try:
362 try:
365 lexer = lexers.guess_lexer_for_filename(self.name, self.content, stripnl=False)
363 lexer = lexers.guess_lexer_for_filename(self.name, self.content, stripnl=False)
366 except lexers.ClassNotFound:
364 except lexers.ClassNotFound:
General Comments 0
You need to be logged in to leave comments. Login now