Skip to content

Disable uploading documentation, direct users to ReadTheDocs. #581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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