aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-04-20 21:01:05 -0400
committerMatti Picus <matti.picus@gmail.com>2021-04-20 21:01:05 -0400
commit10e28ed35802b7a74fbf135371bee557c5601a8b (patch)
tree88dc66257f4974eab819b4451295fcf02b87f469
parentmerge py3.7 into release (diff)
downloadpypy-10e28ed35802b7a74fbf135371bee557c5601a8b.tar.gz
pypy-10e28ed35802b7a74fbf135371bee557c5601a8b.tar.bz2
pypy-10e28ed35802b7a74fbf135371bee557c5601a8b.zip
Remove the pydoc getfile feature (bpo 42988)
-rw-r--r--lib-python/3/pydoc.py18
-rw-r--r--lib-python/3/test/test_pydoc.py6
2 files changed, 0 insertions, 24 deletions
diff --git a/lib-python/3/pydoc.py b/lib-python/3/pydoc.py
index 978e4cd0ba..9677c0d046 100644
--- a/lib-python/3/pydoc.py
+++ b/lib-python/3/pydoc.py
@@ -2348,9 +2348,6 @@ def _url_handler(url, content_type="text/html"):
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>''' % (title, css_link, html_navbar(), contents)
- def filelink(self, url, path):
- return '<a href="getfile?key=%s">%s</a>' % (url, path)
-
html = _HTMLDoc()
@@ -2436,19 +2433,6 @@ def _url_handler(url, content_type="text/html"):
'key = %s' % key, '#ffffff', '#ee77aa', '<br>'.join(results))
return 'Search Results', contents
- def html_getfile(path):
- """Get and display a source file listing safely."""
- path = urllib.parse.unquote(path)
- with tokenize.open(path) as fp:
- lines = html.escape(fp.read())
- body = '<pre>%s</pre>' % lines
- heading = html.heading(
- '<big><big><strong>File Listing</strong></big></big>',
- '#ffffff', '#7799ee')
- contents = heading + html.bigsection(
- 'File: %s' % path, '#ffffff', '#ee77aa', body)
- return 'getfile %s' % path, contents
-
def html_topics():
"""Index of topic texts available."""
@@ -2540,8 +2524,6 @@ def _url_handler(url, content_type="text/html"):
op, _, url = url.partition('=')
if op == "search?key":
title, content = html_search(url)
- elif op == "getfile?key":
- title, content = html_getfile(url)
elif op == "topic?key":
# try topics first, then objects.
try:
diff --git a/lib-python/3/test/test_pydoc.py b/lib-python/3/test/test_pydoc.py
index b47bb133cb..1e94b43f56 100644
--- a/lib-python/3/test/test_pydoc.py
+++ b/lib-python/3/test/test_pydoc.py
@@ -1067,18 +1067,12 @@ class PydocUrlHandlerTest(PydocBaseTest):
("topic?key=def", "Pydoc: KEYWORD def"),
("topic?key=STRINGS", "Pydoc: TOPIC STRINGS"),
("foobar", "Pydoc: Error - foobar"),
- ("getfile?key=foobar", "Pydoc: Error - getfile?key=foobar"),
]
with self.restrict_walk_packages():
for url, title in requests:
self.call_url_handler(url, title)
- path = string.__file__
- title = "Pydoc: getfile " + path
- url = "getfile?key=" + path
- self.call_url_handler(url, title)
-
class TestHelper(unittest.TestCase):
def test_keywords(self):