Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7122839
D1418.id4585.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D1418.id4585.diff
View Options
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
@@ -42,22 +42,12 @@
context = {
'deposit_id': deposit.id,
- 'status': deposit.status,
'status_detail': status_detail,
- 'swh_id': None,
- 'swh_id_context': None,
- 'swh_anchor_id': None,
- 'swh_anchor_id_context': None,
}
-
- if deposit.swh_id:
- context['swh_id'] = deposit.swh_id
- if deposit.swh_id_context:
- context['swh_id_context'] = deposit.swh_id_context
- if deposit.swh_anchor_id:
- context['swh_anchor_id'] = deposit.swh_anchor_id
- if deposit.swh_anchor_id_context:
- context['swh_anchor_id_context'] = deposit.swh_anchor_id_context
+ keys = ('status', 'swh_id', 'swh_id_context', 'swh_anchor_id',
+ 'swh_anchor_id_context', 'external_id')
+ for k in keys:
+ context[k] = getattr(deposit, k, None)
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 %}<deposit_swh_id_context>{{ swh_id_context }}</deposit_swh_id_context>{% endif %}
{% if swh_anchor_id is not None %}<deposit_swh_anchor_id>{{ swh_anchor_id }}</deposit_swh_anchor_id>{% endif %}
{% if swh_anchor_id_context is not None %}<deposit_swh_anchor_id_context>{{ swh_anchor_id_context }}</deposit_swh_anchor_id_context>{% endif %}
+ {% if external_id is not None %}<deposit_external_id>{{ external_id }}</deposit_external_id>{% endif %}
</entry>
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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 17 2024, 6:12 AM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221603
Attached To
D1418: deposit.cli: Generate uuid as is
Event Timeline
Log In to Comment