Make docutils requirement explicit. Fixes #1243.

Previously, the error returned by Python when docutils is not installed
was not explicit, instead saying that HTMLTranslator is not defined
(needed by FeedGenerator and such), forcing the user to go into
readers.py to figure out that this happens because "import docutils"
failed.

This pull request makes the docutils dependency explicit, so that there
is an ImportError if doctutils is not found.
This commit is contained in:
Tastalian 2014-03-10 04:16:38 +01:00 committed by Justin Mayer
commit 260953da02

View file

@ -6,16 +6,13 @@ import logging
import os import os
import re import re
try: import docutils
import docutils import docutils.core
import docutils.core import docutils.io
import docutils.io from docutils.writers.html4css1 import HTMLTranslator
from docutils.writers.html4css1 import HTMLTranslator
# import the directives to have pygments support # import the directives to have pygments support
from pelican import rstdirectives # NOQA from pelican import rstdirectives # NOQA
except ImportError:
docutils = False
try: try:
from markdown import Markdown from markdown import Markdown
except ImportError: except ImportError: