From patchwork Wed Mar 4 11:54:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1248969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48XXPg2hShz9sQt for ; Wed, 4 Mar 2020 22:55:19 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=default header.b=Iv1Ws65P; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48XXPf5NSXzDqXP for ; Wed, 4 Mar 2020 22:55:18 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=199.181.239.182; helo=relay0182.mxlogin.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=default header.b=Iv1Ws65P; dkim-atps=neutral Received: from relay0182.mxlogin.com (relay0182.mxlogin.com [199.181.239.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48XXPX3rvxzDqVc for ; Wed, 4 Mar 2020 22:55:11 +1100 (AEDT) Received: from filter004.mxroute.com ([149.28.56.236] 149.28.56.236.vultr.com) (Authenticated sender: mN4UYu2MZsgR) by relay0182.mxlogin.com (ZoneMTA) with ESMTPSA id 170a5664026000c6c5.002 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Wed, 04 Mar 2020 11:55:06 +0000 X-Zone-Loop: c1bacbc3c11d588e7df82a2c2eae117bea833f81f53c X-Originating-IP: [149.28.56.236] Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter004.mxroute.com (Postfix) with ESMTPS id 9BBE53E9E3; Wed, 4 Mar 2020 11:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4xTdFXmEtMYzjnZVEBq95POEscYP5ufDSJuHPSPappw=; b=Iv1Ws65PSOwq5Nwr6TWT3gFBY2 LDwdoUvHcmrhUvy2MS/Ge9DTFDIAajk6AV7h9xITZyku74n2MtiHqE6jHhZ+KgGUo8Oai4U4kJfQI pENPlCa2DKukPdrjWi2lVO4RHuCvCXw0FdqznKmQC/rDqhXvWP9ZcH0AwWf6iqAu2/M4LNqmc33Ya /rKZm/qDUOX80SOui9GZFNMl5MsHNQo8y1EQgHrV7rkocw0zUh4WKBY9r8pawI7LMx6liSMyTMIzl HXZRwQjzgMSYADISpksiEMsYwlwyOqbW+Uo3ovYgSA2GAJmebOgvcIarcClyv4QL9ClJk9BHGYbuy 1pUAmdVA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 1/5] trivial: Rename 'CoverLetter' references to 'Cover' Date: Wed, 4 Mar 2020 11:54:53 +0000 Message-Id: <20200304115457.32300-2-stephen@that.guru> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200304115457.32300-1-stephen@that.guru> References: <20200304115457.32300-1-stephen@that.guru> MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" We're going to be doing some model surgery shortly. Do the necessary renaming of variables ahead of this. Signed-off-by: Stephen Finucane Reviewed-by: Andrew Donnellan --- docs/api/schemas/latest/patchwork.yaml | 14 +++++++------- docs/api/schemas/patchwork.j2 | 14 +++++++------- docs/api/schemas/v1.0/patchwork.yaml | 14 +++++++------- docs/api/schemas/v1.1/patchwork.yaml | 14 +++++++------- docs/api/schemas/v1.2/patchwork.yaml | 14 +++++++------- patchwork/api/cover.py | 24 ++++++++++++------------ patchwork/api/embedded.py | 2 +- patchwork/api/event.py | 4 ++-- patchwork/api/filters.py | 2 +- patchwork/api/series.py | 4 ++-- patchwork/tests/api/test_cover.py | 2 +- patchwork/tests/test_detail.py | 2 +- patchwork/urls.py | 4 ++-- 13 files changed, 57 insertions(+), 57 deletions(-) diff --git a/docs/api/schemas/latest/patchwork.yaml b/docs/api/schemas/latest/patchwork.yaml index 4cee1513..a739d8ac 100644 --- a/docs/api/schemas/latest/patchwork.yaml +++ b/docs/api/schemas/latest/patchwork.yaml @@ -257,7 +257,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/covers/{id}/: @@ -278,7 +278,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1557,7 +1557,7 @@ components: items: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1619,9 +1619,9 @@ components: type: string format: uri readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -2125,7 +2125,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -2238,7 +2238,7 @@ components: maxLength: 255 minLength: 1 readOnly: true - CoverLetterEmbedded: + CoverEmbedded: type: object properties: id: diff --git a/docs/api/schemas/patchwork.j2 b/docs/api/schemas/patchwork.j2 index c2f5ea6a..05283521 100644 --- a/docs/api/schemas/patchwork.j2 +++ b/docs/api/schemas/patchwork.j2 @@ -262,7 +262,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/{{ version_url }}covers/{id}/: @@ -283,7 +283,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1603,7 +1603,7 @@ components: items: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1673,9 +1673,9 @@ components: format: uri readOnly: true {% endif %} - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -2193,7 +2193,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -2308,7 +2308,7 @@ components: maxLength: 255 minLength: 1 readOnly: true - CoverLetterEmbedded: + CoverEmbedded: type: object properties: id: diff --git a/docs/api/schemas/v1.0/patchwork.yaml b/docs/api/schemas/v1.0/patchwork.yaml index 6c7c068a..642c7773 100644 --- a/docs/api/schemas/v1.0/patchwork.yaml +++ b/docs/api/schemas/v1.0/patchwork.yaml @@ -142,7 +142,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/1.0/covers/{id}/: @@ -163,7 +163,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1389,7 +1389,7 @@ components: items: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1431,9 +1431,9 @@ components: items: $ref: '#/components/schemas/SeriesEmbedded' readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -1881,7 +1881,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -1967,7 +1967,7 @@ components: maxLength: 255 minLength: 1 readOnly: true - CoverLetterEmbedded: + CoverEmbedded: type: object properties: id: diff --git a/docs/api/schemas/v1.1/patchwork.yaml b/docs/api/schemas/v1.1/patchwork.yaml index babc972a..5c268c62 100644 --- a/docs/api/schemas/v1.1/patchwork.yaml +++ b/docs/api/schemas/v1.1/patchwork.yaml @@ -142,7 +142,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/1.1/covers/{id}/: @@ -163,7 +163,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1399,7 +1399,7 @@ components: items: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1456,9 +1456,9 @@ components: type: string format: uri readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -1932,7 +1932,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -2018,7 +2018,7 @@ components: maxLength: 255 minLength: 1 readOnly: true - CoverLetterEmbedded: + CoverEmbedded: type: object properties: id: diff --git a/docs/api/schemas/v1.2/patchwork.yaml b/docs/api/schemas/v1.2/patchwork.yaml index be79e386..f93d5dfa 100644 --- a/docs/api/schemas/v1.2/patchwork.yaml +++ b/docs/api/schemas/v1.2/patchwork.yaml @@ -257,7 +257,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/1.2/covers/{id}/: @@ -278,7 +278,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1557,7 +1557,7 @@ components: items: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1619,9 +1619,9 @@ components: type: string format: uri readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -2125,7 +2125,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -2238,7 +2238,7 @@ components: maxLength: 255 minLength: 1 readOnly: true - CoverLetterEmbedded: + CoverEmbedded: type: object properties: id: diff --git a/patchwork/api/cover.py b/patchwork/api/cover.py index 9e86d47e..8dc2f9ce 100644 --- a/patchwork/api/cover.py +++ b/patchwork/api/cover.py @@ -11,14 +11,14 @@ from rest_framework.reverse import reverse from rest_framework.serializers import SerializerMethodField from patchwork.api.base import BaseHyperlinkedModelSerializer -from patchwork.api.filters import CoverLetterFilterSet +from patchwork.api.filters import CoverFilterSet from patchwork.api.embedded import PersonSerializer from patchwork.api.embedded import ProjectSerializer from patchwork.api.embedded import SeriesSerializer from patchwork.models import CoverLetter -class CoverLetterListSerializer(BaseHyperlinkedModelSerializer): +class CoverListSerializer(BaseHyperlinkedModelSerializer): web_url = SerializerMethodField() project = ProjectSerializer(read_only=True) @@ -43,7 +43,7 @@ class CoverLetterListSerializer(BaseHyperlinkedModelSerializer): # NOTE(stephenfin): This is here to ensure our API looks the same even # after we changed the series-patch relationship from M:N to 1:N. It # will be removed in API v2 - data = super(CoverLetterListSerializer, self).to_representation( + data = super(CoverListSerializer, self).to_representation( instance) data['series'] = [data['series']] if data['series'] else [] return data @@ -63,7 +63,7 @@ class CoverLetterListSerializer(BaseHyperlinkedModelSerializer): } -class CoverLetterDetailSerializer(CoverLetterListSerializer): +class CoverDetailSerializer(CoverListSerializer): headers = SerializerMethodField() @@ -83,18 +83,18 @@ class CoverLetterDetailSerializer(CoverLetterListSerializer): class Meta: model = CoverLetter - fields = CoverLetterListSerializer.Meta.fields + ( + fields = CoverListSerializer.Meta.fields + ( 'headers', 'content') read_only_fields = fields - extra_kwargs = CoverLetterListSerializer.Meta.extra_kwargs - versioned_fields = CoverLetterListSerializer.Meta.versioned_fields + extra_kwargs = CoverListSerializer.Meta.extra_kwargs + versioned_fields = CoverListSerializer.Meta.versioned_fields -class CoverLetterList(ListAPIView): +class CoverList(ListAPIView): """List cover letters.""" - serializer_class = CoverLetterListSerializer - filter_class = filterset_class = CoverLetterFilterSet + serializer_class = CoverListSerializer + filter_class = filterset_class = CoverFilterSet search_fields = ('name',) ordering_fields = ('id', 'name', 'date', 'submitter') ordering = 'id' @@ -105,10 +105,10 @@ class CoverLetterList(ListAPIView): .defer('content', 'headers') -class CoverLetterDetail(RetrieveAPIView): +class CoverDetail(RetrieveAPIView): """Show a cover letter.""" - serializer_class = CoverLetterDetailSerializer + serializer_class = CoverDetailSerializer def get_queryset(self): return CoverLetter.objects.all()\ diff --git a/patchwork/api/embedded.py b/patchwork/api/embedded.py index de4f3116..bcf4f7ce 100644 --- a/patchwork/api/embedded.py +++ b/patchwork/api/embedded.py @@ -102,7 +102,7 @@ class CheckSerializer(SerializedRelatedField): } -class CoverLetterSerializer(SerializedRelatedField): +class CoverSerializer(SerializedRelatedField): class _Serializer(MboxMixin, WebURLMixin, BaseHyperlinkedModelSerializer): diff --git a/patchwork/api/event.py b/patchwork/api/event.py index fdff6a4f..8182324b 100644 --- a/patchwork/api/event.py +++ b/patchwork/api/event.py @@ -11,7 +11,7 @@ from rest_framework.serializers import SerializerMethodField from rest_framework.serializers import SlugRelatedField from patchwork.api.embedded import CheckSerializer -from patchwork.api.embedded import CoverLetterSerializer +from patchwork.api.embedded import CoverSerializer from patchwork.api.embedded import PatchSerializer from patchwork.api.embedded import ProjectSerializer from patchwork.api.embedded import SeriesSerializer @@ -26,7 +26,7 @@ class EventSerializer(ModelSerializer): actor = UserSerializer() patch = PatchSerializer(read_only=True) series = SeriesSerializer(read_only=True) - cover = CoverLetterSerializer(read_only=True) + cover = CoverSerializer(read_only=True) previous_state = SlugRelatedField(slug_field='slug', read_only=True) current_state = SlugRelatedField(slug_field='slug', read_only=True) previous_delegate = UserSerializer() diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py index 60f1a363..2d4b6355 100644 --- a/patchwork/api/filters.py +++ b/patchwork/api/filters.py @@ -172,7 +172,7 @@ class SeriesFilterSet(TimestampMixin, BaseFilterSet): fields = ('submitter', 'project') -class CoverLetterFilterSet(TimestampMixin, BaseFilterSet): +class CoverFilterSet(TimestampMixin, BaseFilterSet): project = ProjectFilter(queryset=Project.objects.all()) # NOTE(stephenfin): We disable the select-based HTML widgets for these diff --git a/patchwork/api/series.py b/patchwork/api/series.py index df28f95d..af04c445 100644 --- a/patchwork/api/series.py +++ b/patchwork/api/series.py @@ -10,7 +10,7 @@ from rest_framework.serializers import SerializerMethodField from patchwork.api.base import BaseHyperlinkedModelSerializer from patchwork.api.base import PatchworkPermission from patchwork.api.filters import SeriesFilterSet -from patchwork.api.embedded import CoverLetterSerializer +from patchwork.api.embedded import CoverSerializer from patchwork.api.embedded import PatchSerializer from patchwork.api.embedded import PersonSerializer from patchwork.api.embedded import ProjectSerializer @@ -23,7 +23,7 @@ class SeriesSerializer(BaseHyperlinkedModelSerializer): project = ProjectSerializer(read_only=True) submitter = PersonSerializer(read_only=True) mbox = SerializerMethodField() - cover_letter = CoverLetterSerializer(read_only=True) + cover_letter = CoverSerializer(read_only=True) patches = PatchSerializer(read_only=True, many=True) def get_web_url(self, instance): diff --git a/patchwork/tests/api/test_cover.py b/patchwork/tests/api/test_cover.py index 16cc0cd9..4fa82a48 100644 --- a/patchwork/tests/api/test_cover.py +++ b/patchwork/tests/api/test_cover.py @@ -21,7 +21,7 @@ if settings.ENABLE_REST_API: @unittest.skipUnless(settings.ENABLE_REST_API, 'requires ENABLE_REST_API') -class TestCoverLetterAPI(utils.APITestCase): +class TestCoverAPI(utils.APITestCase): fixtures = ['default_tags'] @staticmethod diff --git a/patchwork/tests/test_detail.py b/patchwork/tests/test_detail.py index 32fbfaf7..0384e7ae 100644 --- a/patchwork/tests/test_detail.py +++ b/patchwork/tests/test_detail.py @@ -11,7 +11,7 @@ from patchwork.tests.utils import create_cover from patchwork.tests.utils import create_patch -class CoverLetterViewTest(TestCase): +class CoverViewTest(TestCase): def test_redirect(self): patch = create_patch() diff --git a/patchwork/urls.py b/patchwork/urls.py index dcdcfb49..9c3b85f0 100644 --- a/patchwork/urls.py +++ b/patchwork/urls.py @@ -207,10 +207,10 @@ if settings.ENABLE_REST_API: api_person_views.PersonDetail.as_view(), name='api-person-detail'), url(r'^covers/$', - api_cover_views.CoverLetterList.as_view(), + api_cover_views.CoverList.as_view(), name='api-cover-list'), url(r'^covers/(?P[^/]+)/$', - api_cover_views.CoverLetterDetail.as_view(), + api_cover_views.CoverDetail.as_view(), name='api-cover-detail'), url(r'^patches/$', api_patch_views.PatchList.as_view(),