Skip to content

Commit f69a871

Browse files
committed
Link to the correct PEP source file.
Some PEPs are using the .rst extension, and many are in .txt. The source link currently assumes that all the PEPs are using the .txt extension. Fixes python/peps#431
1 parent e17bb48 commit f69a871

File tree

4 files changed

+1311
-1
lines changed

4 files changed

+1311
-1
lines changed

peps/converters.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,14 @@ def convert_pep_page(pep_number, content):
181181

182182
data['content'] = str(pep_content)
183183

184-
source_link = "https://github.com/python/peps/blob/master/pep-{0}.txt".format(pep_number)
184+
pep_ext = ".txt"
185+
pep_rst_source = os.path.join(settings.PEP_REPO_PATH,
186+
'pep-{}.rst'.format(pep_number))
187+
if os.path.exists(pep_rst_source):
188+
pep_ext = ".rst"
189+
190+
source_link = "https://github.com/python/peps/blob/master/pep-{0}{1}".format(
191+
pep_number, pep_ext)
185192
data['content'] += """Source: <a href="{0}">{0}</a>""".format(source_link)
186193
return data
187194

0 commit comments

Comments
 (0)