Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9345353
D4603.id16341.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D4603.id16341.diff
View Options
diff --git a/swh/deposit/api/collection.py b/swh/deposit/api/collection.py
--- a/swh/deposit/api/collection.py
+++ b/swh/deposit/api/collection.py
@@ -21,7 +21,6 @@
ParsedRequestHeaders,
Receipt,
get_collection_by_name,
- guess_deposit_origin_url,
)
@@ -133,11 +132,9 @@
# then no parent for that deposit, deposit_parent already None
pass
- deposit = Deposit(
+ return Deposit(
collection=collection,
external_id=external_id or "",
client=client,
parent=deposit_parent,
)
- deposit.origin_url = guess_deposit_origin_url(deposit)
- return deposit
diff --git a/swh/deposit/api/common.py b/swh/deposit/api/common.py
--- a/swh/deposit/api/common.py
+++ b/swh/deposit/api/common.py
@@ -226,6 +226,9 @@
deposit.status = DEPOSIT_STATUS_DEPOSITED
deposit.save()
+ if deposit.external_id and not deposit.origin_url:
+ deposit.origin_url = guess_deposit_origin_url(deposit)
+
if self.config["checks"]:
scheduler = self.scheduler
if deposit.status == DEPOSIT_STATUS_DEPOSITED and not deposit.check_task_id:
@@ -238,7 +241,7 @@
check_task_id = scheduler.create_tasks([task])[0]["id"]
deposit.check_task_id = check_task_id
- deposit.save()
+ deposit.save()
def _deposit_request_put(
self,
diff --git a/swh/deposit/tests/api/test_deposit_private_read_metadata.py b/swh/deposit/tests/api/test_deposit_private_read_metadata.py
--- a/swh/deposit/tests/api/test_deposit_private_read_metadata.py
+++ b/swh/deposit/tests/api/test_deposit_private_read_metadata.py
@@ -272,10 +272,7 @@
actual_data = response.json()
assert actual_data == {
- "origin": {
- "type": "deposit",
- "url": "https://hal-test.archives-ouvertes.fr/external-id-partial",
- },
+ "origin": {"type": "deposit", "url": None,},
"metadata_raw": [codemeta_entry_data],
"metadata_dict": parse_xml(codemeta_entry_data),
"provider": {
@@ -344,10 +341,7 @@
actual_data = response.json()
assert actual_data == {
- "origin": {
- "type": "deposit",
- "url": "https://hal-test.archives-ouvertes.fr/external-id-partial",
- },
+ "origin": {"type": "deposit", "url": None,},
"metadata_raw": [codemeta_entry_data],
"metadata_dict": parse_xml(codemeta_entry_data),
"provider": {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 3:19 PM (5 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217405
Attached To
D4603: Defer origin_url computation until the deposit completes.
Event Timeline
Log In to Comment