From 42cbd54f2899c6af1e2fe7d07400550105df4e44 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sun, 12 May 2019 12:21:25 -0400 Subject: [PATCH 01/32] Remove an outdated comment --- warehouse/legacy/api/simple.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/warehouse/legacy/api/simple.py b/warehouse/legacy/api/simple.py index b511f4d4bf05..a3bf32ae5e27 100644 --- a/warehouse/legacy/api/simple.py +++ b/warehouse/legacy/api/simple.py @@ -63,8 +63,6 @@ def simple_index(request): ], ) def simple_detail(project, request): - # TODO: Handle files which are not hosted on PyPI - # Make sure that we're using the normalized version of the URL. if project.normalized_name != request.matchdict.get( "name", project.normalized_name From e17181d534ab64d2afae9b286dce3c6e99e08d1a Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sun, 12 May 2019 12:29:11 -0400 Subject: [PATCH 02/32] Add Release.yanked to the database model --- .../c81265f0353c_add_release_yanked.py | 33 +++++++++++++++++++ warehouse/packaging/models.py | 9 +++++ 2 files changed, 42 insertions(+) create mode 100644 warehouse/migrations/versions/c81265f0353c_add_release_yanked.py diff --git a/warehouse/migrations/versions/c81265f0353c_add_release_yanked.py b/warehouse/migrations/versions/c81265f0353c_add_release_yanked.py new file mode 100644 index 000000000000..a1b9f293deac --- /dev/null +++ b/warehouse/migrations/versions/c81265f0353c_add_release_yanked.py @@ -0,0 +1,33 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +Add Release.yanked + +Revision ID: c81265f0353c +Revises: 9ca7d5668af4 +Create Date: 2019-05-12 16:27:21.993967 +""" + +import sqlalchemy as sa + +from alembic import op + +revision = "c81265f0353c" +down_revision = "9ca7d5668af4" + + +def upgrade(): + op.add_column("releases", sa.Column("yanked", sa.Text(), nullable=True)) + + +def downgrade(): + op.drop_column("releases", "yanked") diff --git a/warehouse/packaging/models.py b/warehouse/packaging/models.py index 4b11d7c7a1e3..533b1cc99427 100644 --- a/warehouse/packaging/models.py +++ b/warehouse/packaging/models.py @@ -349,6 +349,11 @@ def __table_args__(cls): # noqa ), ) + # Record information about whether a release is yanked, and if it is why? + # Note: A Null value indicates this release has not been yanked, and any other value + # indicates that it has been yanked. + yanked = Column(Text) + _classifiers = orm.relationship( Classifier, backref="project_releases", @@ -447,6 +452,10 @@ def has_meta(self): ] ) + @property + def is_yanked(self): + return self.yanked is not None + class File(db.Model): From 9bf0022d532648f157ae3f9ade0226c7a98b5f2a Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sun, 12 May 2019 12:35:22 -0400 Subject: [PATCH 03/32] Emit the data-yanked attribute in the simple api --- warehouse/templates/legacy/api/simple/detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warehouse/templates/legacy/api/simple/detail.html b/warehouse/templates/legacy/api/simple/detail.html index 4f3d888f88f8..0e92b96ef45b 100644 --- a/warehouse/templates/legacy/api/simple/detail.html +++ b/warehouse/templates/legacy/api/simple/detail.html @@ -19,7 +19,7 @@

Links for {{ project.name }}

{% for file in files -%} - {{ file.filename }}
+ {{ file.filename }}
{% endfor -%} From c170953ad9cb4b8efee3d49e447c73e3d0602f78 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sun, 12 May 2019 13:19:18 -0400 Subject: [PATCH 04/32] Initial work on a UI for yanking releases --- warehouse/templates/manage/release.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/warehouse/templates/manage/release.html b/warehouse/templates/manage/release.html index 25754a34d385..b91f8132992a 100644 --- a/warehouse/templates/manage/release.html +++ b/warehouse/templates/manage/release.html @@ -121,6 +121,15 @@

{% trans %}No files found{% endtrans %}

{% trans %}Release settings{% endtrans %}

+
+

Yank release

+

+ Yanking will mark this release{% if files %}, and {{ files|length() }} {% trans count=files|length %}file{% pluralize %}files{% endtrans %}{% endif %} + to be ignored when installing in most common scenarios, except when being + installed as a pinned release. +

+
+

{% trans %}Delete release{% endtrans %}

@@ -136,7 +145,7 @@

{% trans %}Delete release{% endtrans %}

{% endif %} {% trans trimmed href='https://www.python.org/dev/peps/pep-0440/#post-releases', title=gettext('External link') %} You will not be able to re-upload a new distribution of the same type with the same version number. - Consider making a new release or a post release instead. + Consider yanking this release, making a new release, or a post release instead. {% endtrans %}

{{ confirm_button(gettext("Delete release"), gettext("Version"), "version", release.version) }} From 26018e567b2011b79183f285d49354d6bd516394 Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Thu, 12 Mar 2020 18:39:20 -0500 Subject: [PATCH 05/32] Update down_revision on migration --- .../migrations/versions/c81265f0353c_add_release_yanked.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/warehouse/migrations/versions/c81265f0353c_add_release_yanked.py b/warehouse/migrations/versions/c81265f0353c_add_release_yanked.py index a1b9f293deac..f87cc6420ad6 100644 --- a/warehouse/migrations/versions/c81265f0353c_add_release_yanked.py +++ b/warehouse/migrations/versions/c81265f0353c_add_release_yanked.py @@ -13,7 +13,7 @@ Add Release.yanked Revision ID: c81265f0353c -Revises: 9ca7d5668af4 +Revises: 5c029d9ef925 Create Date: 2019-05-12 16:27:21.993967 """ @@ -22,7 +22,7 @@ from alembic import op revision = "c81265f0353c" -down_revision = "9ca7d5668af4" +down_revision = "5c029d9ef925" def upgrade(): From 84806bcfeed9b39d1c83807b5116743e436b9fe5 Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Thu, 12 Mar 2020 19:57:50 -0500 Subject: [PATCH 06/32] Remove z-index for callout-block As is, this makes a callout with a higher modifier appear over a modal with a lower modifier. --- warehouse/static/sass/blocks/_callout-block.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/warehouse/static/sass/blocks/_callout-block.scss b/warehouse/static/sass/blocks/_callout-block.scss index 6cdf40f01ccf..d65c442f63c7 100644 --- a/warehouse/static/sass/blocks/_callout-block.scss +++ b/warehouse/static/sass/blocks/_callout-block.scss @@ -45,7 +45,6 @@ border: 2px solid $primary-color; margin: 15px 0; position: relative; - z-index: index($z-index-scale, "callout-block"); border-radius: 4px; &__dismiss { @@ -64,7 +63,6 @@ top: -1px; left: -2px; height: calc(100% + 2px); - z-index: index($z-index-scale, "callout-block-border"); border-radius: 3px 0 0 3px; } From ccefa1e18b7b92cd21ae144ad3db853f4c8f055d Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Thu, 12 Mar 2020 19:59:52 -0500 Subject: [PATCH 07/32] Add ability to specify modifier when creating a confirm_button or confirm_modal --- warehouse/templates/manage/manage_base.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/warehouse/templates/manage/manage_base.html b/warehouse/templates/manage/manage_base.html index fd90caab6c02..970408f313c6 100644 --- a/warehouse/templates/manage/manage_base.html +++ b/warehouse/templates/manage/manage_base.html @@ -86,7 +86,8 @@ method="POST", warning=True, custom_warning_text="", - confirm_string_in_title="True") + confirm_string_in_title="True", + modifier="--danger") %}