mirror of
https://github.com/python/cpython.git
synced 2025-09-03 15:31:08 +00:00
Handle Windows paths and don't double up on HTML header sections in new pydoc URL handler
This commit is contained in:
parent
1eb40bc945
commit
ecace28ef4
2 changed files with 19 additions and 17 deletions
|
@ -237,8 +237,10 @@ def print_diffs(text1, text2):
|
|||
print('\n' + ''.join(diffs))
|
||||
|
||||
def get_html_title(text):
|
||||
_, _, text = text.rpartition("<title>")
|
||||
title, _, _ = text.rpartition("</title>")
|
||||
# Bit of hack, but good enough for test purposes
|
||||
header, _, _ = text.partition("</head>")
|
||||
_, _, title = header.partition("<title>")
|
||||
title, _, _ = title.partition("</title>")
|
||||
return title
|
||||
|
||||
|
||||
|
@ -449,7 +451,7 @@ class PyDocUrlHandlerTest(unittest.TestCase):
|
|||
self.assertEqual(result, title)
|
||||
|
||||
path = string.__file__
|
||||
title = "Python: getfile /" + path
|
||||
title = "Python: getfile " + path
|
||||
url = "getfile?key=" + path
|
||||
text = pydoc._url_handler(url, "text/html")
|
||||
result = get_html_title(text)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue