Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/origin_save.py
Show First 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | def create_save_origin_request(visit_type, origin_url): | ||||
# origin can not be saved as its url is blacklisted, | # origin can not be saved as its url is blacklisted, | ||||
# log the request to the database anyway | # log the request to the database anyway | ||||
else: | else: | ||||
sor = SaveOriginRequest.objects.create(visit_type=visit_type, | sor = SaveOriginRequest.objects.create(visit_type=visit_type, | ||||
origin_url=origin_url, | origin_url=origin_url, | ||||
status=save_request_status) | status=save_request_status) | ||||
if save_request_status == SAVE_REQUEST_REJECTED: | if save_request_status == SAVE_REQUEST_REJECTED: | ||||
raise ForbiddenExc('The origin url is blacklisted and will not be ' | raise ForbiddenExc(('The "save code now" request has been rejected ' | ||||
'loaded into the archive.') | 'because the provided origin url is blacklisted.')) | ||||
return _save_request_dict(sor, task) | return _save_request_dict(sor, task) | ||||
def get_save_origin_requests_from_queryset(requests_queryset): | def get_save_origin_requests_from_queryset(requests_queryset): | ||||
""" | """ | ||||
Get all save requests from a SaveOriginRequest queryset. | Get all save requests from a SaveOriginRequest queryset. | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |