[Python-checkins] r61843 - in doctools/trunk: CHANGES sphinx/__init__.py sphinx/environment.py

georg.brandl python-checkins at python.org
Mon Mar 24 10:42:28 CET 2008


Author: georg.brandl
Date: Mon Mar 24 10:42:28 2008
New Revision: 61843

Modified:
   doctools/trunk/CHANGES
   doctools/trunk/sphinx/__init__.py   (props changed)
   doctools/trunk/sphinx/environment.py
Log:
Don't error out on reading an empty file.


Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Mon Mar 24 10:42:28 2008
@@ -19,6 +19,8 @@
 * sphinx.htmlwriter: Make parsed-literal blocks work as expected,
   not highlighting them via Pygments.
 
+* sphinx.environment: Don't error out on reading an empty source file.
+
 
 Release 0.1.61798 (Mar 23, 2008)
 ================================

Modified: doctools/trunk/sphinx/environment.py
==============================================================================
--- doctools/trunk/sphinx/environment.py	(original)
+++ doctools/trunk/sphinx/environment.py	Mon Mar 24 10:42:28 2008
@@ -457,7 +457,11 @@
         Process the docinfo part of the doctree as metadata.
         """
         self.metadata[docname] = md = {}
-        docinfo = doctree[0]
+        try:
+            docinfo = doctree[0]
+        except IndexError:
+            # probably an empty document
+            return
         if docinfo.__class__ is not nodes.docinfo:
             # nothing to see here
             return


More information about the Python-checkins mailing list