Skip to content

Commit

Permalink
Merge pull request pypi#581 from dstufft/remove-doc-upload
Browse files Browse the repository at this point in the history
Disable uploading documentation, direct users to ReadTheDocs.
  • Loading branch information
dstufft committed Aug 5, 2015
2 parents 7ade1cf + fec537b commit eafcd84
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/functional/legacy_api/test_removed.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ def test_removed_upload_apis(webtest, action):
resp = webtest.post("/pypi?:action={}".format(action), status=410)
assert resp.status == \
"410 This API is no longer supported, instead simply upload the file."


def test_remove_doc_upload(webtest):
resp = webtest.post("/pypi?:action=doc_upload", status=410)
assert resp.status == (
"410 Uploading documentation is no longer supported, we recommend "
"using https://readthedocs.org/."
)
10 changes: 10 additions & 0 deletions tests/unit/legacy/api/test_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,16 @@ def test_submit(pyramid_request):
"410 This API is no longer supported, instead simply upload the file."


def test_doc_upload(pyramid_request):
resp = pypi.doc_upload(pyramid_request)

assert resp.status_code == 410
assert resp.status == (
"410 Uploading documentation is no longer supported, we recommend "
"using https://readthedocs.org/."
)


def test_forbidden_legacy():
exc, request = pretend.stub(), pretend.stub()
resp = pypi.forbidden_legacy(exc, request)
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ def add_pypi_action_route(name, action, **kwargs):
pretend.call("legacy.api.pypi.file_upload", "file_upload"),
pretend.call("legacy.api.pypi.submit", "submit"),
pretend.call("legacy.api.pypi.submit_pkg_info", "submit_pkg_info"),
pretend.call("legacy.api.pypi.doc_upload", "doc_upload"),
]
12 changes: 12 additions & 0 deletions warehouse/legacy/api/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,18 @@ def submit(request):
)


@view_config(
route_name="legacy.api.pypi.doc_upload",
decorator=[require_POST, csrf_exempt],
)
def doc_upload(request):
return _exc_with_message(
HTTPGone,
"Uploading documentation is no longer supported, we recommend using "
"https://readthedocs.org/.",
)


@forbidden_view_config(request_param=":action")
def forbidden_legacy(exc, request):
# We're not going to do anything amazing here, this just exists to override
Expand Down
1 change: 1 addition & 0 deletions warehouse/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def includeme(config):
"legacy.api.pypi.submit_pkg_info",
"submit_pkg_info",
)
config.add_pypi_action_route("legacy.api.pypi.doc_upload", "doc_upload")

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

0 comments on commit eafcd84

Please sign in to comment.