Commits

Georg Brandl committed 56416fb

Fixes #870: silence spurious KeyErrors when removing documents.

  • Participants
  • Parent commits 857e686
  • Branches stable

Comments (0)

Files changed (2)

 
 * #876: Fix quickstart test under Python 3.
 
+* #870: Fix spurious KeyErrors when removing documents.
+
 
 Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
 ======================================================================

File sphinx/environment.py

 
     def get_toc_for(self, docname, builder):
         """Return a TOC nodetree -- for use on the same page only!"""
-        toc = self.tocs[docname].deepcopy()
+        try:
+            toc = self.tocs[docname].deepcopy()
+        except KeyError:
+            # the document does not exist anymore: return a dummy node that
+            # renders to nothing
+            return nodes.paragraph()
         self.process_only_nodes(toc, builder, docname)
         for node in toc.traverse(nodes.reference):
             node['refuri'] = node['anchorname'] or '#'