Page MenuHomeSoftware Heritage

Make <swh:add_to_origin> set Deposit.origin_url + disable aggressive deprecation warning
ClosedPublic

Authored by vlorentz on Jan 14 2021, 10:47 AM.

Details

Summary

deposit.parent can be true in two cases:

  1. because we got <swh:add_to_origin> -> then the deprecation warning is raised before this check is reached, because 'deposit.origin_url' is set
  2. because we got a slug -> then we shouldn't raise this error (it breaks existing clients that didn't stop using <external_identifier> yet)

Diff Detail

Repository
rDDEP Push deposit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D4861 (id=17205)

Could not rebase; Attempt merge onto 82a26b5e86...

Updating 82a26b5e..69a86148
Fast-forward
 swh/deposit/api/common.py                              | 8 ++------
 swh/deposit/tests/api/test_collection_add_to_origin.py | 3 ++-
 swh/deposit/tests/api/test_collection_reuse_slug.py    | 5 +++++
 3 files changed, 9 insertions(+), 7 deletions(-)
Changes applied before test
commit 69a8614841466cfe9d499b1018dbed7522b1552a
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jan 14 10:45:25 2021 +0100

    Make <swh:add_to_origin> set Deposit.origin_url + disable aggressive deprecation warning
    
    deposit.parent can be true in two cases:
    
    1. because we got <swh:add_to_origin> -> then the deprecation warning is raised
       before this check is reached, because 'deposit.origin_url' is set
    2. because we got a slug -> then we shouldn't raise this error (it breaks
       existing clients that didn't stop using <external_identifier> yet)

commit 835ccc100edcd6b8c10760d6e292091bf6c70cf6
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jan 14 10:41:14 2021 +0100

    test_collection_reuse_slug: Assert Deposit.origin_url is set.

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/525/ for more details.

Build is green

Patch application report for D4861 (id=17206)

Could not rebase; Attempt merge onto 82a26b5e86...

Updating 82a26b5e..38788d90
Fast-forward
 swh/deposit/api/common.py                          |  8 +---
 .../tests/api/test_collection_add_to_origin.py     |  3 +-
 swh/deposit/tests/api/test_collection_post_atom.py | 30 +++++++++++++++
 .../tests/api/test_collection_reuse_slug.py        | 45 ++++++++++++++++++++++
 4 files changed, 79 insertions(+), 7 deletions(-)
Changes applied before test
commit 38788d907c70164dd12dc95a1f9f48fbfc34f02c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jan 14 10:45:25 2021 +0100

    Make <swh:add_to_origin> set Deposit.origin_url + disable aggressive deprecation warning
    
    deposit.parent can be true in two cases:
    
    1. because we got <swh:add_to_origin> -> then the deprecation warning is raised
       before this check is reached, because 'deposit.origin_url' is set
    2. because we got a slug -> then we shouldn't raise this error (it breaks
       existing clients that didn't stop using <external_identifier> yet)

commit 835ccc100edcd6b8c10760d6e292091bf6c70cf6
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jan 14 10:41:14 2021 +0100

    test_collection_reuse_slug: Assert Deposit.origin_url is set.

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/526/ for more details.

This revision is now accepted and ready to land.Jan 14 2021, 12:34 PM