Skip to content

Commit

Permalink
Add a shortlink for projects (pypi#3165)
Browse files Browse the repository at this point in the history
To make it easier for people who want to type project URLs, this will
redirect all requests for `/p/<project>/` to `/project/<project>/`.

Closes pypi#3143

Signed-off-by: Andy Dirnberger <[email protected]>
  • Loading branch information
dirn authored and Mariatta committed Mar 9, 2018
1 parent 45926ae commit 7a89558
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/unit/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}/",
Expand Down
1 change: 1 addition & 0 deletions warehouse/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def includeme(config):
)

# Packaging
config.add_redirect('/p/{name}/', '/project/{name}/', domain=warehouse)
config.add_route(
"packaging.project",
"/project/{name}/",
Expand Down

0 comments on commit 7a89558

Please sign in to comment.