Page MenuHomeSoftware Heritage

D3626.diff
No OneTemporary

D3626.diff

diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -3,5 +3,5 @@
swh.model >= 0.5.0
swh.scheduler >= 0.1.1
swh.search >= 0.0.4
-swh.storage >= 0.11.3
+swh.storage >= 0.11.4
swh.vault >= 0.0.33
diff --git a/swh/web/common/service.py b/swh/web/common/service.py
--- a/swh/web/common/service.py
+++ b/swh/web/common/service.py
@@ -940,7 +940,7 @@
"""Return information about visit visit_id with origin origin.
Args:
- origin (str): origin concerned by the visit
+ origin: origin concerned by the visit
visit_id: the visit identifier to lookup
Yields:
@@ -951,10 +951,9 @@
visit_status = storage.origin_visit_status_get_latest(origin_url, visit_id)
if not visit:
raise NotFoundExc(
- "Origin %s or its visit " "with id %s not found!" % (origin_url, visit_id)
+ f"Origin {origin_url} or its visit with id {visit_id} not found!"
)
- visit["origin"] = origin_url
- return converters.from_origin_visit({**visit, **visit_status.to_dict()})
+ return converters.from_origin_visit({**visit_status.to_dict(), "type": visit.type})
def lookup_snapshot_sizes(snapshot_id):
diff --git a/swh/web/tests/conftest.py b/swh/web/tests/conftest.py
--- a/swh/web/tests/conftest.py
+++ b/swh/web/tests/conftest.py
@@ -19,6 +19,7 @@
from swh.model.hashutil import ALGORITHMS, hash_to_bytes
from swh.web.common import converters
+from swh.web.common.typing import OriginVisitInfo
from swh.web.tests.data import get_tests_data, override_storages
from swh.storage.algos.origin import origin_get_latest_visit_status
from swh.storage.algos.snapshot import snapshot_get_latest
@@ -237,10 +238,14 @@
)
return visits
- def origin_visit_get_by(self, origin_url, visit_id):
+ def origin_visit_get_by(self, origin_url: str, visit_id: int) -> OriginVisitInfo:
visit = self.storage.origin_visit_get_by(origin_url, visit_id)
+ assert visit is not None
visit_status = self.storage.origin_visit_status_get_latest(origin_url, visit_id)
- return converters.from_origin_visit({**visit, **visit_status.to_dict()})
+ assert visit_status is not None
+ return converters.from_origin_visit(
+ {**visit_status.to_dict(), "type": visit.type}
+ )
def origin_visit_status_get_latest(
self,

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 17, 3:15 PM (2 d, 20 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223280

Event Timeline