Browse files

Don't using logging when importing wok.renders.

Because logging has not been set up yet (because we haven't parsed CLI
options yet) making calls to logging.* will cause logging to be set up
with default values, which is bad.

This is a bad fix. The real fix should be to move parsing of CLI options
to another stage so that we can set up logging before importing the
renders. But that is a bigger change.

ugh ugh ugh ugh ugh ugh ugh.
  • Loading branch information...
mythmon committed Jun 2, 2012
1 parent b7cc538 commit f30fc025f210b1a22db02015c4db0c1e0c6b79a3
Showing with 18 additions and 11 deletions.
  1. +18 −11 wok/
@@ -1,13 +1,13 @@
-import logging
from wok import util
# Check for pygments
import pygments
have_pygments = True
except ImportError:
-'Pygments not enabled.')
+ #XXX
+'Pygments not enabled.')
+ print 'Pygments not enabled.'
have_pygments = False
# List of available renderers
@@ -49,7 +49,9 @@ def render(cls, plain):
except ImportError:
- logging.debug("markdown isn't available, trying markdown2")
+ #XXX
+ #logging.debug("markdown isn't available, trying markdown2")
+ print "markdown isn't available, trying markdown2"
markdown = None
# Try Markdown2
@@ -69,8 +71,10 @@ def render(cls, plain):
return markdown2.markdown(plain, extras=cls.extras)
- except:
-'Markdown not enabled.')
+ except ImportError:
+ #XXX
+'Markdown not enabled.')
+ print 'Markdown not enabled.'
# Include ReStructuredText Parser, if we have docutils
@@ -93,8 +97,10 @@ def render(cls, plain):
return docutils.core.publish_parts(plain, writer=w)['body']
-'reStructuredText not enabled.')
+except ImportError:
+ #XXX
+'reStructuredText not enabled.')
+ print 'reStructuredText not enabled.'
# Try Textile
@@ -109,9 +115,10 @@ def render(cls, plain):
return textile.textile(plain)
-'Textile not enabled.')
+except ImportError:
+ #XXX
+'Textile not enabled.')
+ print 'Textile not enabled.'
if len(all) <= 2:

0 comments on commit f30fc02

Please sign in to comment.