Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/origin.py
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | |||||
@browse_route(r'origin/(?P<origin_id>[0-9]+)/latest_snapshot/', | @browse_route(r'origin/(?P<origin_id>[0-9]+)/latest_snapshot/', | ||||
view_name='browse-origin-latest-snapshot') | view_name='browse-origin-latest-snapshot') | ||||
def _origin_latest_snapshot(request, origin_id): | def _origin_latest_snapshot(request, origin_id): | ||||
""" | """ | ||||
Internal browse endpoint used to check if an origin has already | Internal browse endpoint used to check if an origin has already | ||||
been visited by Software Heritage and has at least one full visit. | been visited by Software Heritage and has at least one full visit. | ||||
""" | """ | ||||
result = \ | result = \ | ||||
service.lookup_latest_origin_snapshot(origin_id, | service.lookup_latest_origin_snapshot(int(origin_id), | ||||
allowed_statuses=['full', | allowed_statuses=['full', | ||||
'partial']) | 'partial']) | ||||
result = json.dumps(result, sort_keys=True, indent=4, | result = json.dumps(result, sort_keys=True, indent=4, | ||||
separators=(',', ': ')) | separators=(',', ': ')) | ||||
return HttpResponse(result, content_type='application/json') | return HttpResponse(result, content_type='application/json') | ||||
Show All 12 Lines |