Georg Brandl avatar Georg Brandl committed 56416fb

Fixes #870: silence spurious KeyErrors when removing documents.

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!
 ======================================================================

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 '#'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.