Import pygments only when needed
Sun Oct 5 15:53:16 UTC 2008 Alberto Bertogli <albertito@gmail.com>
* Import pygments only when needed
Otherwise, we pay for the pygments import (which is noticeable) on every
darcsweb page view.
This follows the lazy module loading that is already being done for other
costly modules (i.e. 're').
{
hunk ./darcsweb.cgi 22
-try:
- import pygments
- import pygments.lexers
- import pygments.formatters
-except ImportError:
- pygments = False
-
hunk ./darcsweb.cgi 1273
+ try:
+ import pygments
+ except ImportError:
+ pygments = False
+
hunk ./darcsweb.cgi 1316
+ import pygments
+ import pygments.lexers
+ import pygments.formatters
+
}