Fixes #870: silence spurious KeyErrors when removing documents.

This commit is contained in:
Georg Brandl 2012-03-10 19:09:01 +01:00
parent 01167a8af5
commit 87c50b6605
2 changed files with 8 additions and 1 deletions

View File

@ -46,6 +46,8 @@ Release 1.1.3 (in development)
* #876: Fix quickstart test under Python 3. * #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! Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
====================================================================== ======================================================================

View File

@ -1164,7 +1164,12 @@ class BuildEnvironment:
def get_toc_for(self, docname, builder): def get_toc_for(self, docname, builder):
"""Return a TOC nodetree -- for use on the same page only!""" """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) self.process_only_nodes(toc, builder, docname)
for node in toc.traverse(nodes.reference): for node in toc.traverse(nodes.reference):
node['refuri'] = node['anchorname'] or '#' node['refuri'] = node['anchorname'] or '#'