diff --git a/swh/deposit/api/deposit_status.py b/swh/deposit/api/deposit_status.py --- a/swh/deposit/api/deposit_status.py +++ b/swh/deposit/api/deposit_status.py @@ -48,6 +48,7 @@ 'swh_id_context': None, 'swh_anchor_id': None, 'swh_anchor_id_context': None, + 'external_id': None, } if deposit.swh_id: @@ -58,6 +59,8 @@ context['swh_anchor_id'] = deposit.swh_anchor_id if deposit.swh_anchor_id_context: context['swh_anchor_id_context'] = deposit.swh_anchor_id_context + if deposit.external_id: + context['external_id'] = deposit.external_id return render(req, 'deposit/status.xml', context=context, diff --git a/swh/deposit/cli/deposit.py b/swh/deposit/cli/deposit.py --- a/swh/deposit/cli/deposit.py +++ b/swh/deposit/cli/deposit.py @@ -23,11 +23,11 @@ pass -def generate_slug(prefix='swh-sample'): +def generate_slug(): """Generate a slug (sample purposes). """ - return '%s-%s' % (prefix, uuid.uuid4()) + return str(uuid.uuid4()) def client_command_parse_input( diff --git a/swh/deposit/client/__init__.py b/swh/deposit/client/__init__.py --- a/swh/deposit/client/__init__.py +++ b/swh/deposit/client/__init__.py @@ -350,7 +350,9 @@ 'deposit_swh_id', 'deposit_swh_id_context', 'deposit_swh_anchor_id', - 'deposit_swh_anchor_id_context']) + 'deposit_swh_anchor_id_context', + 'deposit_external_id', + ]) class BaseCreateDepositClient(BaseDepositClient): diff --git a/swh/deposit/templates/deposit/status.xml b/swh/deposit/templates/deposit/status.xml --- a/swh/deposit/templates/deposit/status.xml +++ b/swh/deposit/templates/deposit/status.xml @@ -8,4 +8,5 @@ {% if swh_id_context is not None %}{{ swh_id_context }}{% endif %} {% if swh_anchor_id is not None %}{{ swh_anchor_id }}{% endif %} {% if swh_anchor_id_context is not None %}{{ swh_anchor_id_context }}{% endif %} + {% if external_id is not None %}{{ external_id }}{% endif %} diff --git a/swh/deposit/tests/api/test_deposit_status.py b/swh/deposit/tests/api/test_deposit_status.py --- a/swh/deposit/tests/api/test_deposit_status.py +++ b/swh/deposit/tests/api/test_deposit_status.py @@ -64,6 +64,7 @@ self.assertEqual(r['deposit_status'], DEPOSIT_STATUS_DEPOSITED) self.assertEqual(r['deposit_status_detail'], DEPOSIT_STATUS_DETAIL[DEPOSIT_STATUS_DEPOSITED]) + self.assertEqual(r['deposit_external_id'], external_id) def test_status_with_swh_information(self): _status = DEPOSIT_STATUS_LOAD_SUCCESS