diff options
author | Stephen Finucane <stephen@that.guru> | 2020-03-01 15:13:23 +0000 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2020-04-26 13:45:36 +0100 |
commit | c8a799fc54875393adf60a7d7f90c9baf6b388ca (patch) | |
tree | d306bd0017f6562704c941318e2fed620103499c | |
parent | 781303bce0d8e94eae957bd3b30abe9a7849d981 (diff) | |
download | patchwork-c8a799fc54875393adf60a7d7f90c9baf6b388ca.tar patchwork-c8a799fc54875393adf60a7d7f90c9baf6b388ca.tar.gz |
trivial: Rename 'CoverLetter' references to 'Cover'
We're going to be doing some model surgery shortly. Do the necessary
renaming of variables ahead of this.
Signed-off-by: Stephen Finucane <stephen@that.guru>
-rw-r--r-- | docs/api/schemas/latest/patchwork.yaml | 16 | ||||
-rw-r--r-- | docs/api/schemas/patchwork.j2 | 16 | ||||
-rw-r--r-- | docs/api/schemas/v1.0/patchwork.yaml | 16 | ||||
-rw-r--r-- | docs/api/schemas/v1.1/patchwork.yaml | 16 | ||||
-rw-r--r-- | docs/api/schemas/v1.2/patchwork.yaml | 16 | ||||
-rw-r--r-- | patchwork/api/cover.py | 24 | ||||
-rw-r--r-- | patchwork/api/embedded.py | 2 | ||||
-rw-r--r-- | patchwork/api/event.py | 4 | ||||
-rw-r--r-- | patchwork/api/filters.py | 2 | ||||
-rw-r--r-- | patchwork/api/series.py | 4 | ||||
-rw-r--r-- | patchwork/tests/api/test_cover.py | 2 | ||||
-rw-r--r-- | patchwork/tests/test_detail.py | 2 | ||||
-rw-r--r-- | patchwork/urls.py | 4 |
13 files changed, 62 insertions, 62 deletions
diff --git a/docs/api/schemas/latest/patchwork.yaml b/docs/api/schemas/latest/patchwork.yaml index 20ca90e..a8910a7 100644 --- a/docs/api/schemas/latest/patchwork.yaml +++ b/docs/api/schemas/latest/patchwork.yaml @@ -249,7 +249,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/covers/{id}/: @@ -270,7 +270,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1528,7 +1528,7 @@ components: additionalProperties: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1590,9 +1590,9 @@ components: type: string format: uri readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -1652,7 +1652,7 @@ components: payload: properties: cover: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' EventPatchCreated: allOf: - $ref: '#/components/schemas/EventBase' @@ -2131,7 +2131,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -2244,7 +2244,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 1ec3848..c55f6f4 100644 --- a/docs/api/schemas/patchwork.j2 +++ b/docs/api/schemas/patchwork.j2 @@ -256,7 +256,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/{{ version_url }}covers/{id}/: @@ -277,7 +277,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1586,7 +1586,7 @@ components: additionalProperties: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1656,9 +1656,9 @@ components: format: uri readOnly: true {% endif %} - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -1720,7 +1720,7 @@ components: payload: properties: cover: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' EventPatchCreated: allOf: - $ref: '#/components/schemas/EventBase' @@ -2217,7 +2217,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -2332,7 +2332,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 e946c9e..23e8930 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: @@ -1344,7 +1344,7 @@ components: additionalProperties: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1386,9 +1386,9 @@ components: items: $ref: '#/components/schemas/SeriesEmbedded' readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -1440,7 +1440,7 @@ components: payload: properties: cover: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' EventPatchCreated: allOf: - $ref: '#/components/schemas/EventBase' @@ -1842,7 +1842,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -1928,7 +1928,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 614a7fb..5acd33a 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: @@ -1354,7 +1354,7 @@ components: additionalProperties: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1411,9 +1411,9 @@ components: type: string format: uri readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -1465,7 +1465,7 @@ components: payload: properties: cover: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' EventPatchCreated: allOf: - $ref: '#/components/schemas/EventBase' @@ -1911,7 +1911,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -1997,7 +1997,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 6545493..712d137 100644 --- a/docs/api/schemas/v1.2/patchwork.yaml +++ b/docs/api/schemas/v1.2/patchwork.yaml @@ -249,7 +249,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/CoverLetterList' + $ref: '#/components/schemas/CoverList' tags: - covers /api/1.2/covers/{id}/: @@ -270,7 +270,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CoverLetterDetail' + $ref: '#/components/schemas/CoverDetail' '404': description: Not found content: @@ -1528,7 +1528,7 @@ components: additionalProperties: type: string readOnly: true - CoverLetterList: + CoverList: type: object properties: id: @@ -1590,9 +1590,9 @@ components: type: string format: uri readOnly: true - CoverLetterDetail: + CoverDetail: allOf: - - $ref: '#/components/schemas/CoverLetterList' + - $ref: '#/components/schemas/CoverList' - properties: headers: title: Headers @@ -1652,7 +1652,7 @@ components: payload: properties: cover: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' EventPatchCreated: allOf: - $ref: '#/components/schemas/EventBase' @@ -2131,7 +2131,7 @@ components: format: uri readOnly: true cover_letter: - $ref: '#/components/schemas/CoverLetterEmbedded' + $ref: '#/components/schemas/CoverEmbedded' patches: title: Patches type: array @@ -2244,7 +2244,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 c0c27fe..66d2146 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' @@ -106,10 +106,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 cb3f07e..1478e74 100644 --- a/patchwork/api/embedded.py +++ b/patchwork/api/embedded.py @@ -103,7 +103,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 d7a99c7..7ed9efb 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 PatchRelationSerializer from patchwork.api.embedded import ProjectSerializer @@ -27,7 +27,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 93e6281..a328d59 100644 --- a/patchwork/api/filters.py +++ b/patchwork/api/filters.py @@ -188,7 +188,7 @@ def msgid_filter(queryset, name, value): return queryset.filter(**{name: '<' + value + '>'}) -class CoverLetterFilterSet(TimestampMixin, BaseFilterSet): +class CoverFilterSet(TimestampMixin, BaseFilterSet): project = ProjectFilter(queryset=Project.objects.all(), distinct=False) # NOTE(stephenfin): We disable the select-based HTML widgets for these diff --git a/patchwork/api/series.py b/patchwork/api/series.py index e4cffaa..106e60f 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 1b19ded..806ee6a 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 92fe2d7..ddc2b93 100644 --- a/patchwork/tests/test_detail.py +++ b/patchwork/tests/test_detail.py @@ -12,7 +12,7 @@ from patchwork.tests.utils import create_patch from patchwork.tests.utils import create_project -class CoverLetterViewTest(TestCase): +class CoverViewTest(TestCase): def test_redirect(self): patch = create_patch() diff --git a/patchwork/urls.py b/patchwork/urls.py index dcdcfb4..9c3b85f 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<pk>[^/]+)/$', - 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(), |