[Python-checkins] r62325 - doctools/trunk/sphinx/ext/autodoc.py

georg.brandl python-checkins at python.org
Sun Apr 13 19:43:59 CEST 2008


Author: georg.brandl
Date: Sun Apr 13 19:43:59 2008
New Revision: 62325

Log:
Gracefully handle situation where module name is unknown.


Modified:
   doctools/trunk/sphinx/ext/autodoc.py

Modified: doctools/trunk/sphinx/ext/autodoc.py
==============================================================================
--- doctools/trunk/sphinx/ext/autodoc.py	(original)
+++ doctools/trunk/sphinx/ext/autodoc.py	Sun Apr 13 19:43:59 2008
@@ -100,6 +100,13 @@
 
     result = ViewList()
 
+    if mod is None:
+        warning = document.reporter.warning(
+            'don\'t know which module to import for documenting '
+            '%r (try placing a "module" directive in the document, '
+            'or giving an explicit module name)' % name, line=lineno)
+        return [warning], result
+
     try:
         todoc = module = __import__(mod, None, None, ['foo'])
         if filename_set is not None and hasattr(module, '__file__') and module.__file__:


More information about the Python-checkins mailing list