Page MenuHomeSoftware Heritage

browse: Normalize origin url query parameter name
ClosedPublic

Authored by anlambert on Apr 24 2020, 5:20 PM.

Details

Summary

Some browse views different from origin context ones can take an
optional 'origin' query parameter name. For consistency whith origin
context views, rename that parameter to 'origin_url'.

Backward compatibility is already ensured in current implementation.

Depends on D3064.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added a subscriber: ardumont.

looks fine.

i was gonna ask about the name "url" instead of "origin_url" in the main diff.
But i guess, here as we are not necessarily in the origin context, the name origin is not necessarily present in the base url.
So it's probably best to keep that "origin_url" everywhere.

This revision is now accepted and ready to land.Apr 24 2020, 5:23 PM

looks fine.

i was gonna ask about the name "url" instead of "origin_url" in the main diff.
But i guess, here as we are not necessarily in the origin context, the name origin is not necessarily present in the base url.
So it's probably best to keep that "origin_url" everywhere.

From my side, I was hesitating between origin_url and origin. But we may extend info attached to origins in the future
and provide new origin_* query parameters in views so I sticked to origin_url.

Build is green

Patch application report for D3066 (id=10901)

Could not rebase; Attempt merge onto b6448adfe4...

Updating b6448adf..d38c7028
Fast-forward
 cypress/integration/code-highlighting.spec.js      |   4 +-
 cypress/integration/content-display.spec.js        |   8 +-
 cypress/integration/directory.spec.js              |   6 +-
 cypress/integration/errors.spec.js                 |   9 +-
 cypress/integration/language-select.spec.js        |   4 +-
 cypress/integration/origin-visits.spec.js          |   4 +-
 cypress/integration/persistent-identifiers.spec.js |   6 +-
 docs/uri-scheme-browse-origin.rst                  | 302 ++++++++++++++++++---
 docs/uri-scheme-browse-snapshot.rst                |   4 +-
 docs/uri-scheme-browse.rst                         |   8 +-
 swh/web/assets/src/bundles/admin/origin-save.js    |   4 +-
 swh/web/assets/src/bundles/browse/origin-search.js |   2 +-
 swh/web/assets/src/bundles/save/index.js           |   4 +-
 swh/web/assets/src/bundles/webapp/badges.js        |   4 +-
 swh/web/browse/snapshot_context.py                 |  40 ++-
 swh/web/browse/utils.py                            |   8 +-
 swh/web/browse/views/content.py                    |   2 +-
 swh/web/browse/views/directory.py                  |   4 +-
 swh/web/browse/views/origin.py                     | 143 ++++++----
 swh/web/browse/views/release.py                    |   8 +-
 swh/web/browse/views/revision.py                   |  11 +-
 swh/web/common/identifiers.py                      |   2 +-
 swh/web/misc/badges.py                             |   6 +-
 swh/web/templates/browse/browse.html               |   6 +-
 swh/web/templates/browse/help.html                 |  30 +-
 swh/web/tests/api/views/test_identifiers.py        |   2 +-
 swh/web/tests/browse/test_snapshot_context.py      |  24 +-
 swh/web/tests/browse/views/test_directory.py       |   2 +-
 swh/web/tests/browse/views/test_identifiers.py     |   8 +-
 swh/web/tests/browse/views/test_origin.py          | 164 ++++++-----
 swh/web/tests/browse/views/test_release.py         |  10 +-
 swh/web/tests/browse/views/test_revision.py        |   9 +-
 swh/web/tests/common/test_identifiers.py           |   2 +-
 swh/web/tests/misc/test_badges.py                  |   2 +-
 34 files changed, 554 insertions(+), 298 deletions(-)
Changes applied before test
commit d38c70281838265015a89156fc62d2860ad6514d
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Fri Apr 24 17:18:29 2020 +0200

    browse: Normalize origin url query parameter name
    
    Some browse views different from origin context ones can take an
    optional 'origin' query parameter name. For consistency whith origin
    context views, rename that parameter to 'origin_url'.
    
    Backward compatibility is already ensured in current implementation.

commit 3c15e040d6b39534692be1afcf2f2336c42b4fbd
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Apr 23 18:40:20 2020 +0200

    browse: Turn origin_url to a query parameter in origin context views
    
    Deprecate all origin context views taking an origin as url argument and add
    new views taking the origin url as query parameter.
    
    This change should mitigate double-slash issue that can happen on some clients
    or under certain apache2 configuration.

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

Build is green

Patch application report for D3066 (id=10903)

Could not rebase; Attempt merge onto b6448adfe4...

Updating b6448adf..70fa1e19
Fast-forward
 cypress/integration/code-highlighting.spec.js      |   4 +-
 cypress/integration/content-display.spec.js        |   8 +-
 cypress/integration/directory.spec.js              |   6 +-
 cypress/integration/errors.spec.js                 |   9 +-
 cypress/integration/language-select.spec.js        |   4 +-
 cypress/integration/origin-visits.spec.js          |   4 +-
 cypress/integration/persistent-identifiers.spec.js |   6 +-
 docs/uri-scheme-browse-origin.rst                  | 318 ++++++++++++++++++---
 docs/uri-scheme-browse-snapshot.rst                |   4 +-
 docs/uri-scheme-browse.rst                         |   8 +-
 swh/web/assets/src/bundles/admin/origin-save.js    |   4 +-
 swh/web/assets/src/bundles/browse/origin-search.js |   2 +-
 swh/web/assets/src/bundles/save/index.js           |   4 +-
 swh/web/assets/src/bundles/webapp/badges.js        |   4 +-
 swh/web/browse/snapshot_context.py                 |  40 ++-
 swh/web/browse/utils.py                            |   8 +-
 swh/web/browse/views/content.py                    |   2 +-
 swh/web/browse/views/directory.py                  |   4 +-
 swh/web/browse/views/origin.py                     | 143 +++++----
 swh/web/browse/views/release.py                    |   8 +-
 swh/web/browse/views/revision.py                   |  11 +-
 swh/web/common/identifiers.py                      |   2 +-
 swh/web/misc/badges.py                             |   6 +-
 swh/web/templates/browse/browse.html               |   6 +-
 swh/web/templates/browse/help.html                 |  30 +-
 swh/web/tests/api/views/test_identifiers.py        |   2 +-
 swh/web/tests/browse/test_snapshot_context.py      |  24 +-
 swh/web/tests/browse/views/test_directory.py       |   2 +-
 swh/web/tests/browse/views/test_identifiers.py     |   8 +-
 swh/web/tests/browse/views/test_origin.py          | 164 +++++------
 swh/web/tests/browse/views/test_release.py         |  10 +-
 swh/web/tests/browse/views/test_revision.py        |   9 +-
 swh/web/tests/common/test_identifiers.py           |   2 +-
 swh/web/tests/misc/test_badges.py                  |   2 +-
 34 files changed, 562 insertions(+), 306 deletions(-)
Changes applied before test
commit 70fa1e196c995259b4b7dce3752164d61a98e5dd
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Fri Apr 24 17:18:29 2020 +0200

    browse: Normalize origin url query parameter name
    
    Some browse views different from origin context ones can take an
    optional 'origin' query parameter name. For consistency whith origin
    context views, rename that parameter to 'origin_url'.
    
    Backward compatibility is already ensured in current implementation.

commit 6da9fade15d901dcee6f29af7780f73d8fdfbfd4
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Apr 23 18:40:20 2020 +0200

    browse: Turn origin_url to a query parameter in origin context views
    
    Deprecate all origin context views taking an origin as url argument and add
    new views taking the origin url as query parameter.
    
    This change should mitigate double-slash issue that can happen on some clients
    or under certain apache2 configuration.

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