Skip to content

Commit 5c7c23f

Browse files
committed
generate_rss: make pep_abstract more robust
This eliminates an AttributeError during PEP editing, if the PEP being edited has an Abstract or Introduction section but with no interior content (i.e. paragraphs) yet. In practice this should have no effect on actual RSS feeds, since merged PEPs should always have a proper abstract. However, this prevents a confusing error from bubbling up during local editing. See #4355. Signed-off-by: William Woodruff <[email protected]>
1 parent 56768d6 commit 5c7c23f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pep_sphinx_extensions/generate_rss.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ def pep_abstract(document: nodes.document) -> str:
5959
if title_node is None:
6060
continue
6161

62+
para_node = None
6263
if title_node.astext() == "Abstract":
63-
return node.next_node(nodes.paragraph).astext().strip().replace("\n", " ")
64+
para_node = node.next_node(nodes.paragraph)
6465
elif title_node.astext() == "Introduction":
65-
introduction = node.next_node(nodes.paragraph).astext().strip().replace("\n", " ")
66+
para_node = node.next_node(nodes.paragraph)
67+
68+
if para_node:
69+
introduction = para_node.astext().strip().replace("\n", " ")
6670

6771
return introduction
6872

0 commit comments

Comments
 (0)