comparison piecrust/formatting/hoedownformatter.py @ 695:0c688063890f

formatting: Don't import `hoedown` until we need it.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 23 Mar 2016 10:53:30 -0700
parents b917ae071994
children 8adc27285d93
comparison
equal deleted inserted replaced
694:b917ae071994 695:0c688063890f
1 import logging 1 import logging
2 import hoedown
3 from piecrust.formatting.base import Formatter 2 from piecrust.formatting.base import Formatter
4 3
5 4
6 logger = logging.getLogger(__name__) 5 logger = logging.getLogger(__name__)
7 6
20 return self._formatter.render(txt) 19 return self._formatter.render(txt)
21 20
22 def _ensureInitialized(self): 21 def _ensureInitialized(self):
23 if self._formatter is not None: 22 if self._formatter is not None:
24 return 23 return
24
25 import hoedown
25 26
26 # Don't show warnings once for each worker when baking, so only 27 # Don't show warnings once for each worker when baking, so only
27 # show them for the first. If the variable is not set, we're not 28 # show them for the first. If the variable is not set, we're not
28 # baking so do show them either way. 29 # baking so do show them either way.
29 show_warnings = (self.app.config.get('baker/worker_id', 0) == 0) 30 show_warnings = (self.app.config.get('baker/worker_id', 0) == 0)