From 7a895584621509c5c29106fb931a381df97abe68 Mon Sep 17 00:00:00 2001 From: Andy Dirnberger Date: Wed, 7 Mar 2018 17:10:37 -0500 Subject: [PATCH] Add a shortlink for projects (#3165) To make it easier for people who want to type project URLs, this will redirect all requests for `/p//` to `/project//`. Closes #3143 Signed-off-by: Andy Dirnberger --- tests/unit/test_routes.py | 1 + warehouse/routes.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/unit/test_routes.py b/tests/unit/test_routes.py index 362b91010524..1d9607ca39a7 100644 --- a/tests/unit/test_routes.py +++ b/tests/unit/test_routes.py @@ -269,6 +269,7 @@ def add_policy(name, filename): ] assert config.add_redirect.calls == [ + pretend.call("/p/{name}/", "/project/{name}/", domain=warehouse), pretend.call("/pypi/{name}/", "/project/{name}/", domain=warehouse), pretend.call( "/pypi/{name}/{version}/", diff --git a/warehouse/routes.py b/warehouse/routes.py index 0a49b73894fc..84902feb03f0 100644 --- a/warehouse/routes.py +++ b/warehouse/routes.py @@ -178,6 +178,7 @@ def includeme(config): ) # Packaging + config.add_redirect('/p/{name}/', '/project/{name}/', domain=warehouse) config.add_route( "packaging.project", "/project/{name}/",