diff --git a/docs/uri-scheme-identifiers.rst b/docs/uri-scheme-identifiers.rst index 064e1569..f46d9e77 100644 --- a/docs/uri-scheme-identifiers.rst +++ b/docs/uri-scheme-identifiers.rst @@ -1,30 +1,31 @@ URI scheme for Software Heritage identifiers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -A subset of Software Heritage objects (contents, directories, releases and revisions) -can be browsed using :ref:`persistent-identifiers`. Those identifiers -are guaranteed to remain stable (persistent) over time. +A subset of Software Heritage objects (contents, directories, releases and +revisions) can be browsed using :ref:`SWHIDs `. Those +identifiers are guaranteed to remain stable (persistent) over time. + .. http:get:: /(swh_id)/ End point to browse Software Heritage objects using their persistent identifiers. A redirection to the adequate HTML view will be performed when reaching it. - :param string swh_id: a persistent identifier for a Software Heritage object - (see the :ref:`persistent-identifiers` section to learn more - about its syntax) + :param string swh_id: a persistent identifier for a Software Heritage + object, or SWHID (see :ref:`persistent identifiers + ` to learn more about its syntax) :resheader Location: the redirection URL for browsing the Software Heritage object associated to the provided identifier :statuscode 302: no error :statuscode 400: the provided identifier is malformed **Examples:** .. parsed-literal:: :swh_web:`swh:1:cnt:0ffd12d85cdec70c88e852fc3f5ea9fd342213cd` :swh_web:`swh:1:dir:db990da9af15427455ce7836ce2b8a34b9bf67f5` :swh_web:`swh:1:rel:a9b7e3f1eada90250a6b2ab2ef3e0a846cb16831` :swh_web:`swh:1:rev:f1b94134a4b879bc55c3dacdb496690c8ebdc03f` :swh_web:`swh:1:snp:673156c31a876c5b99b2fe3e89615529de9a3c44` diff --git a/swh/web/browse/identifiers.py b/swh/web/browse/identifiers.py index be9a0070..4bd6e3f7 100644 --- a/swh/web/browse/identifiers.py +++ b/swh/web/browse/identifiers.py @@ -1,24 +1,24 @@ # Copyright (C) 2017-2020 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information from django.shortcuts import redirect from swh.web.common.identifiers import resolve_swh_persistent_id from swh.web.common.exc import handle_view_exception def swh_id_browse(request, swh_id): """ Django view enabling to browse the archive using - :ref:`persistent-identifiers`. + :ref:`SWHIDs `. The url that points to it is :http:get:`/(swh_id)/`. """ try: swh_id_resolved = resolve_swh_persistent_id(swh_id, query_params=request.GET) except Exception as exc: return handle_view_exception(request, exc) return redirect(swh_id_resolved["browse_url"])