changeset 3876:c5dd289ca96e beta

lazy load pygments lib so we can use VCS without it installed
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 19 May 2013 20:55:40 +0200
parents 5a7d52cf084d
children 5070c840dc23
files rhodecode/lib/vcs/nodes.py
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/vcs/nodes.py	Sun May 19 19:46:54 2013 +0200
+++ b/rhodecode/lib/vcs/nodes.py	Sun May 19 20:55:40 2013 +0200
@@ -13,8 +13,6 @@
 import posixpath
 import mimetypes
 
-from pygments import lexers
-
 from rhodecode.lib.vcs.backends.base import EmptyChangeset
 from rhodecode.lib.vcs.exceptions import NodeError, RemovedFileNodeError
 from rhodecode.lib.vcs.utils.lazy import LazyProperty
@@ -360,7 +358,7 @@
         Returns pygment's lexer class. Would try to guess lexer taking file's
         content, name and mimetype.
         """
-
+        from pygments import lexers
         try:
             lexer = lexers.guess_lexer_for_filename(self.name, self.content, stripnl=False)
         except lexers.ClassNotFound: