Skip to content

Commit eafcd84

Browse files
committed
Merge pull request #581 from dstufft/remove-doc-upload
Disable uploading documentation, direct users to ReadTheDocs.
2 parents 7ade1cf + fec537b commit eafcd84

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

tests/functional/legacy_api/test_removed.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ def test_removed_upload_apis(webtest, action):
1818
resp = webtest.post("/pypi?:action={}".format(action), status=410)
1919
assert resp.status == \
2020
"410 This API is no longer supported, instead simply upload the file."
21+
22+
23+
def test_remove_doc_upload(webtest):
24+
resp = webtest.post("/pypi?:action=doc_upload", status=410)
25+
assert resp.status == (
26+
"410 Uploading documentation is no longer supported, we recommend "
27+
"using https://readthedocs.org/."
28+
)

tests/unit/legacy/api/test_pypi.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,16 @@ def test_submit(pyramid_request):
11511151
"410 This API is no longer supported, instead simply upload the file."
11521152

11531153

1154+
def test_doc_upload(pyramid_request):
1155+
resp = pypi.doc_upload(pyramid_request)
1156+
1157+
assert resp.status_code == 410
1158+
assert resp.status == (
1159+
"410 Uploading documentation is no longer supported, we recommend "
1160+
"using https://readthedocs.org/."
1161+
)
1162+
1163+
11541164
def test_forbidden_legacy():
11551165
exc, request = pretend.stub(), pretend.stub()
11561166
resp = pypi.forbidden_legacy(exc, request)

tests/unit/test_routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,5 @@ def add_pypi_action_route(name, action, **kwargs):
9595
pretend.call("legacy.api.pypi.file_upload", "file_upload"),
9696
pretend.call("legacy.api.pypi.submit", "submit"),
9797
pretend.call("legacy.api.pypi.submit_pkg_info", "submit_pkg_info"),
98+
pretend.call("legacy.api.pypi.doc_upload", "doc_upload"),
9899
]

warehouse/legacy/api/pypi.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,18 @@ def submit(request):
696696
)
697697

698698

699+
@view_config(
700+
route_name="legacy.api.pypi.doc_upload",
701+
decorator=[require_POST, csrf_exempt],
702+
)
703+
def doc_upload(request):
704+
return _exc_with_message(
705+
HTTPGone,
706+
"Uploading documentation is no longer supported, we recommend using "
707+
"https://readthedocs.org/.",
708+
)
709+
710+
699711
@forbidden_view_config(request_param=":action")
700712
def forbidden_legacy(exc, request):
701713
# We're not going to do anything amazing here, this just exists to override

warehouse/routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def includeme(config):
6767
"legacy.api.pypi.submit_pkg_info",
6868
"submit_pkg_info",
6969
)
70+
config.add_pypi_action_route("legacy.api.pypi.doc_upload", "doc_upload")
7071

7172
# Legacy Documentation
7273
config.add_route("legacy.docs", config.registry.settings["docs.url"])

0 commit comments

Comments
 (0)