Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/views/vault.py
Show All 9 Lines | |||||
from swh.model.hashutil import hash_to_hex | from swh.model.hashutil import hash_to_hex | ||||
from swh.model.swhids import CoreSWHID, ObjectType | from swh.model.swhids import CoreSWHID, ObjectType | ||||
from swh.web.api.apidoc import api_doc, format_docstring | from swh.web.api.apidoc import api_doc, format_docstring | ||||
from swh.web.api.apiurls import api_route | from swh.web.api.apiurls import api_route | ||||
from swh.web.api.views.utils import api_lookup | from swh.web.api.views.utils import api_lookup | ||||
from swh.web.common import archive, query | from swh.web.common import archive, query | ||||
from swh.web.common.exc import BadInputExc | from swh.web.common.exc import BadInputExc | ||||
from swh.web.common.utils import reverse | from swh.web.common.utils import SWHID_RE, reverse | ||||
###################################################### | ###################################################### | ||||
# Common | # Common | ||||
SWHID_RE = "swh:1:[a-z]{3}:[0-9a-z]{40}" | |||||
# XXX: a bit spaghetti. Would be better with class-based views. | # XXX: a bit spaghetti. Would be better with class-based views. | ||||
def _dispatch_cook_progress(request, bundle_type: str, swhid: CoreSWHID): | def _dispatch_cook_progress(request, bundle_type: str, swhid: CoreSWHID): | ||||
if request.method == "GET": | if request.method == "GET": | ||||
return api_lookup( | return api_lookup( | ||||
archive.vault_progress, | archive.vault_progress, | ||||
bundle_type, | bundle_type, | ||||
swhid, | swhid, | ||||
▲ Show 20 Lines • Show All 482 Lines • Show Last 20 Lines |