We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Update CI files for branch 3.21

Update CI files for branch 3.21


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pulpcore/app/serializers/publication.py`
Content:
```
1 from gettext import gettext as _
2 
3 from django.core import validators
4 from django.db.models import Q
5 from rest_framework import serializers
6 from rest_framework.validators import UniqueValidator
7 
8 from pulpcore.app import models
9 from pulpcore.app.serializers import (
10     BaseURLField,
11     DetailIdentityField,
12     DetailRelatedField,
13     MasterModelSerializer,
14     ModelSerializer,
15     NestedRelatedField,
16     RelatedField,
17     validate_unknown_fields,
18 )
19 
20 
21 class PublicationSerializer(MasterModelSerializer):
22     _href = DetailIdentityField()
23     repository_version = NestedRelatedField(
24         view_name='versions-detail',
25         lookup_field='number',
26         parent_lookup_kwargs={'repository_pk': 'repository__pk'},
27         queryset=models.RepositoryVersion.objects.all(),
28         required=False,
29     )
30     repository = RelatedField(
31         help_text=_('A URI of the repository to be published.'),
32         required=False,
33         label=_('Repository'),
34         queryset=models.Repository.objects.all(),
35         view_name='repositories-detail',
36         write_only=True
37     )
38 
39     def validate(self, data):
40         if hasattr(self, 'initial_data'):
41             validate_unknown_fields(self.initial_data, self.fields)
42 
43         repository = data.pop('repository', None)  # not an actual field on publication
44         repository_version = data.get('repository_version')
45         if not repository and not repository_version:
46             raise serializers.ValidationError(
47                 _("Either the 'repository' or 'repository_version' need to be specified"))
48         elif not repository and repository_version:
49             return data
50         elif repository and not repository_version:
51             version = models.RepositoryVersion.latest(repository)
52             if version:
53                 new_data = {'repository_version': version}
54                 new_data.update(data)
55                 return new_data
56             else:
57                 raise serializers.ValidationError(
58                     detail=_('Repository has no version available to create Publication from'))
59         raise serializers.ValidationError(
60             _("Either the 'repository' or 'repository_version' need to be specified "
61               "but not both.")
62         )
63 
64     class Meta:
65         abstract = True
66         model = models.Publication
67         fields = MasterModelSerializer.Meta.fields + (
68             'publisher',
69             'repository_version',
70             'repository'
71         )
72 
73 
74 class ContentGuardSerializer(MasterModelSerializer):
75     _href = DetailIdentityField()
76 
77     name = serializers.CharField(
78         help_text=_('The unique name.')
79     )
80     description = serializers.CharField(
81         help_text=_('An optional description.'),
82         allow_null=True,
83         required=False
84     )
85 
86     class Meta:
87         model = models.ContentGuard
88         fields = MasterModelSerializer.Meta.fields + (
89             'name',
90             'description'
91         )
92 
93 
94 class BaseDistributionSerializer(MasterModelSerializer):
95     """
96     The Serializer for the BaseDistribution model.
97 
98     The serializer deliberately omits the "remote" field, which is used for
99     pull-through caching only. Plugins implementing pull-through caching will
100     have to add the field in their derived serializer class like this::
101 
102       remote = DetailRelatedField(
103           required=False,
104           help_text=_('Remote that can be used to fetch content when using pull-through caching.'),
105           queryset=models.Remote.objects.all(),
106           allow_null=True
107       )
108 
109     """
110 
111     _href = DetailIdentityField()
112     base_path = serializers.CharField(
113         help_text=_('The base (relative) path component of the published url. Avoid paths that \
114                     overlap with other distribution base paths (e.g. "foo" and "foo/bar")'),
115         validators=[validators.MaxLengthValidator(
116             models.BaseDistribution._meta.get_field('base_path').max_length,
117             message=_('`base_path` length must be less than {} characters').format(
118                 models.BaseDistribution._meta.get_field('base_path').max_length
119             )),
120             UniqueValidator(queryset=models.BaseDistribution.objects.all()),
121         ]
122     )
123     base_url = BaseURLField(
124         source='base_path', read_only=True,
125         help_text=_('The URL for accessing the publication as defined by this distribution.')
126     )
127     content_guard = DetailRelatedField(
128         required=False,
129         help_text=_('An optional content-guard.'),
130         queryset=models.ContentGuard.objects.all(),
131         allow_null=True
132     )
133     name = serializers.CharField(
134         help_text=_('A unique name. Ex, `rawhide` and `stable`.'),
135         validators=[validators.MaxLengthValidator(
136             models.BaseDistribution._meta.get_field('name').max_length,
137             message=_('`name` length must be less than {} characters').format(
138                 models.BaseDistribution._meta.get_field('name').max_length
139             )),
140             UniqueValidator(queryset=models.BaseDistribution.objects.all())]
141     )
142 
143     class Meta:
144         abstract = True
145         model = models.BaseDistribution
146         fields = ModelSerializer.Meta.fields + (
147             'base_path',
148             'base_url',
149             'content_guard',
150             'name',
151         )
152 
153     def _validate_path_overlap(self, path):
154         # look for any base paths nested in path
155         search = path.split("/")[0]
156         q = Q(base_path=search)
157         for subdir in path.split("/")[1:]:
158             search = "/".join((search, subdir))
159             q |= Q(base_path=search)
160 
161         # look for any base paths that nest path
162         q |= Q(base_path__startswith='{}/'.format(path))
163         qs = models.BaseDistribution.objects.filter(q)
164 
165         if self.instance is not None:
166             qs = qs.exclude(pk=self.instance.pk)
167 
168         match = qs.first()
169         if match:
170             raise serializers.ValidationError(detail=_("Overlaps with existing distribution '"
171                                                        "{}'").format(match.name))
172 
173         return path
174 
175     def validate_base_path(self, path):
176         self._validate_relative_path(path)
177         return self._validate_path_overlap(path)
178 
179 
180 class PublicationDistributionSerializer(BaseDistributionSerializer):
181     publication = DetailRelatedField(
182         required=False,
183         help_text=_('Publication to be served'),
184         queryset=models.Publication.objects.exclude(complete=False),
185         allow_null=True
186     )
187 
188     class Meta:
189         abstract = True
190         fields = BaseDistributionSerializer.Meta.fields + (
191             'publication',
192         )
193 
194 
195 class RepositoryVersionDistributionSerializer(BaseDistributionSerializer):
196     repository = RelatedField(
197         required=False,
198         help_text=_('The latest RepositoryVersion for this Repository will be served.'),
199         queryset=models.Repository.objects.all(),
200         view_name='repositories-detail',
201         allow_null=True
202     )
203     repository_version = NestedRelatedField(
204         required=False,
205         help_text=_('RepositoryVersion to be served'),
206         queryset=models.RepositoryVersion.objects.exclude(complete=False),
207         view_name='versions-detail',
208         allow_null=True,
209         lookup_field='number',
210         parent_lookup_kwargs={'repository_pk': 'repository__pk'},
211     )
212 
213     class Meta:
214         abstract = True
215         fields = BaseDistributionSerializer.Meta.fields + (
216             'repository',
217             'repository_version',
218         )
219 
220     def validate(self, data):
221         super().validate(data)
222 
223         if 'repository' in data and 'repository_version' in data:
224             msg = _("The attributes 'repository' and 'repository_version' must be used"
225                     "exclusively.")
226             raise serializers.ValidationError(msg)
227 
228         return data
229
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pulpcore/app/serializers/publication.py b/pulpcore/app/serializers/publication.py
--- a/pulpcore/app/serializers/publication.py
+++ b/pulpcore/app/serializers/publication.py
@@ -220,9 +220,23 @@
     def validate(self, data):
         super().validate(data)
 
-        if 'repository' in data and 'repository_version' in data:
+        repository_in_data = 'repository' in data
+        repository_version_in_data = 'repository_version' in data
+        repository_in_instance = self.instance.repository if self.instance else None
+        repository_version_in_instance = self.instance.repository_version if self.instance else None
+
+        if repository_in_data and repository_version_in_data:
+            error = True
+        elif repository_in_data and repository_version_in_instance:
+            error = True
+        elif repository_in_instance and repository_version_in_data:
+            error = True
+        else:
+            error = False
+
+        if error:
             msg = _("The attributes 'repository' and 'repository_version' must be used"
-                    "exclusively.")
+                    " exclusively.")
             raise serializers.ValidationError(msg)
 
         return data

{"golden_diff": "diff --git a/pulpcore/app/serializers/publication.py b/pulpcore/app/serializers/publication.py\n--- a/pulpcore/app/serializers/publication.py\n+++ b/pulpcore/app/serializers/publication.py\n@@ -220,9 +220,23 @@\n     def validate(self, data):\n         super().validate(data)\n \n-        if 'repository' in data and 'repository_version' in data:\n+        repository_in_data = 'repository' in data\n+        repository_version_in_data = 'repository_version' in data\n+        repository_in_instance = self.instance.repository if self.instance else None\n+        repository_version_in_instance = self.instance.repository_version if self.instance else None\n+\n+        if repository_in_data and repository_version_in_data:\n+            error = True\n+        elif repository_in_data and repository_version_in_instance:\n+            error = True\n+        elif repository_in_instance and repository_version_in_data:\n+            error = True\n+        else:\n+            error = False\n+\n+        if error:\n             msg = _(\"The attributes 'repository' and 'repository_version' must be used\"\n-                    \"exclusively.\")\n+                    \" exclusively.\")\n             raise serializers.ValidationError(msg)\n \n         return data\n", "issue": "Update CI files for branch 3.21\n\nUpdate CI files for branch 3.21\n\n", "before_files": [{"content": "from gettext import gettext as _\n\nfrom django.core import validators\nfrom django.db.models import Q\nfrom rest_framework import serializers\nfrom rest_framework.validators import UniqueValidator\n\nfrom pulpcore.app import models\nfrom pulpcore.app.serializers import (\n    BaseURLField,\n    DetailIdentityField,\n    DetailRelatedField,\n    MasterModelSerializer,\n    ModelSerializer,\n    NestedRelatedField,\n    RelatedField,\n    validate_unknown_fields,\n)\n\n\nclass PublicationSerializer(MasterModelSerializer):\n    _href = DetailIdentityField()\n    repository_version = NestedRelatedField(\n        view_name='versions-detail',\n        lookup_field='number',\n        parent_lookup_kwargs={'repository_pk': 'repository__pk'},\n        queryset=models.RepositoryVersion.objects.all(),\n        required=False,\n    )\n    repository = RelatedField(\n        help_text=_('A URI of the repository to be published.'),\n        required=False,\n        label=_('Repository'),\n        queryset=models.Repository.objects.all(),\n        view_name='repositories-detail',\n        write_only=True\n    )\n\n    def validate(self, data):\n        if hasattr(self, 'initial_data'):\n            validate_unknown_fields(self.initial_data, self.fields)\n\n        repository = data.pop('repository', None)  # not an actual field on publication\n        repository_version = data.get('repository_version')\n        if not repository and not repository_version:\n            raise serializers.ValidationError(\n                _(\"Either the 'repository' or 'repository_version' need to be specified\"))\n        elif not repository and repository_version:\n            return data\n        elif repository and not repository_version:\n            version = models.RepositoryVersion.latest(repository)\n            if version:\n                new_data = {'repository_version': version}\n                new_data.update(data)\n                return new_data\n            else:\n                raise serializers.ValidationError(\n                    detail=_('Repository has no version available to create Publication from'))\n        raise serializers.ValidationError(\n            _(\"Either the 'repository' or 'repository_version' need to be specified \"\n              \"but not both.\")\n        )\n\n    class Meta:\n        abstract = True\n        model = models.Publication\n        fields = MasterModelSerializer.Meta.fields + (\n            'publisher',\n            'repository_version',\n            'repository'\n        )\n\n\nclass ContentGuardSerializer(MasterModelSerializer):\n    _href = DetailIdentityField()\n\n    name = serializers.CharField(\n        help_text=_('The unique name.')\n    )\n    description = serializers.CharField(\n        help_text=_('An optional description.'),\n        allow_null=True,\n        required=False\n    )\n\n    class Meta:\n        model = models.ContentGuard\n        fields = MasterModelSerializer.Meta.fields + (\n            'name',\n            'description'\n        )\n\n\nclass BaseDistributionSerializer(MasterModelSerializer):\n    \"\"\"\n    The Serializer for the BaseDistribution model.\n\n    The serializer deliberately omits the \"remote\" field, which is used for\n    pull-through caching only. Plugins implementing pull-through caching will\n    have to add the field in their derived serializer class like this::\n\n      remote = DetailRelatedField(\n          required=False,\n          help_text=_('Remote that can be used to fetch content when using pull-through caching.'),\n          queryset=models.Remote.objects.all(),\n          allow_null=True\n      )\n\n    \"\"\"\n\n    _href = DetailIdentityField()\n    base_path = serializers.CharField(\n        help_text=_('The base (relative) path component of the published url. Avoid paths that \\\n                    overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")'),\n        validators=[validators.MaxLengthValidator(\n            models.BaseDistribution._meta.get_field('base_path').max_length,\n            message=_('`base_path` length must be less than {} characters').format(\n                models.BaseDistribution._meta.get_field('base_path').max_length\n            )),\n            UniqueValidator(queryset=models.BaseDistribution.objects.all()),\n        ]\n    )\n    base_url = BaseURLField(\n        source='base_path', read_only=True,\n        help_text=_('The URL for accessing the publication as defined by this distribution.')\n    )\n    content_guard = DetailRelatedField(\n        required=False,\n        help_text=_('An optional content-guard.'),\n        queryset=models.ContentGuard.objects.all(),\n        allow_null=True\n    )\n    name = serializers.CharField(\n        help_text=_('A unique name. Ex, `rawhide` and `stable`.'),\n        validators=[validators.MaxLengthValidator(\n            models.BaseDistribution._meta.get_field('name').max_length,\n            message=_('`name` length must be less than {} characters').format(\n                models.BaseDistribution._meta.get_field('name').max_length\n            )),\n            UniqueValidator(queryset=models.BaseDistribution.objects.all())]\n    )\n\n    class Meta:\n        abstract = True\n        model = models.BaseDistribution\n        fields = ModelSerializer.Meta.fields + (\n            'base_path',\n            'base_url',\n            'content_guard',\n            'name',\n        )\n\n    def _validate_path_overlap(self, path):\n        # look for any base paths nested in path\n        search = path.split(\"/\")[0]\n        q = Q(base_path=search)\n        for subdir in path.split(\"/\")[1:]:\n            search = \"/\".join((search, subdir))\n            q |= Q(base_path=search)\n\n        # look for any base paths that nest path\n        q |= Q(base_path__startswith='{}/'.format(path))\n        qs = models.BaseDistribution.objects.filter(q)\n\n        if self.instance is not None:\n            qs = qs.exclude(pk=self.instance.pk)\n\n        match = qs.first()\n        if match:\n            raise serializers.ValidationError(detail=_(\"Overlaps with existing distribution '\"\n                                                       \"{}'\").format(match.name))\n\n        return path\n\n    def validate_base_path(self, path):\n        self._validate_relative_path(path)\n        return self._validate_path_overlap(path)\n\n\nclass PublicationDistributionSerializer(BaseDistributionSerializer):\n    publication = DetailRelatedField(\n        required=False,\n        help_text=_('Publication to be served'),\n        queryset=models.Publication.objects.exclude(complete=False),\n        allow_null=True\n    )\n\n    class Meta:\n        abstract = True\n        fields = BaseDistributionSerializer.Meta.fields + (\n            'publication',\n        )\n\n\nclass RepositoryVersionDistributionSerializer(BaseDistributionSerializer):\n    repository = RelatedField(\n        required=False,\n        help_text=_('The latest RepositoryVersion for this Repository will be served.'),\n        queryset=models.Repository.objects.all(),\n        view_name='repositories-detail',\n        allow_null=True\n    )\n    repository_version = NestedRelatedField(\n        required=False,\n        help_text=_('RepositoryVersion to be served'),\n        queryset=models.RepositoryVersion.objects.exclude(complete=False),\n        view_name='versions-detail',\n        allow_null=True,\n        lookup_field='number',\n        parent_lookup_kwargs={'repository_pk': 'repository__pk'},\n    )\n\n    class Meta:\n        abstract = True\n        fields = BaseDistributionSerializer.Meta.fields + (\n            'repository',\n            'repository_version',\n        )\n\n    def validate(self, data):\n        super().validate(data)\n\n        if 'repository' in data and 'repository_version' in data:\n            msg = _(\"The attributes 'repository' and 'repository_version' must be used\"\n                    \"exclusively.\")\n            raise serializers.ValidationError(msg)\n\n        return data\n", "path": "pulpcore/app/serializers/publication.py"}], "after_files": [{"content": "from gettext import gettext as _\n\nfrom django.core import validators\nfrom django.db.models import Q\nfrom rest_framework import serializers\nfrom rest_framework.validators import UniqueValidator\n\nfrom pulpcore.app import models\nfrom pulpcore.app.serializers import (\n    BaseURLField,\n    DetailIdentityField,\n    DetailRelatedField,\n    MasterModelSerializer,\n    ModelSerializer,\n    NestedRelatedField,\n    RelatedField,\n    validate_unknown_fields,\n)\n\n\nclass PublicationSerializer(MasterModelSerializer):\n    _href = DetailIdentityField()\n    repository_version = NestedRelatedField(\n        view_name='versions-detail',\n        lookup_field='number',\n        parent_lookup_kwargs={'repository_pk': 'repository__pk'},\n        queryset=models.RepositoryVersion.objects.all(),\n        required=False,\n    )\n    repository = RelatedField(\n        help_text=_('A URI of the repository to be published.'),\n        required=False,\n        label=_('Repository'),\n        queryset=models.Repository.objects.all(),\n        view_name='repositories-detail',\n        write_only=True\n    )\n\n    def validate(self, data):\n        if hasattr(self, 'initial_data'):\n            validate_unknown_fields(self.initial_data, self.fields)\n\n        repository = data.pop('repository', None)  # not an actual field on publication\n        repository_version = data.get('repository_version')\n        if not repository and not repository_version:\n            raise serializers.ValidationError(\n                _(\"Either the 'repository' or 'repository_version' need to be specified\"))\n        elif not repository and repository_version:\n            return data\n        elif repository and not repository_version:\n            version = models.RepositoryVersion.latest(repository)\n            if version:\n                new_data = {'repository_version': version}\n                new_data.update(data)\n                return new_data\n            else:\n                raise serializers.ValidationError(\n                    detail=_('Repository has no version available to create Publication from'))\n        raise serializers.ValidationError(\n            _(\"Either the 'repository' or 'repository_version' need to be specified \"\n              \"but not both.\")\n        )\n\n    class Meta:\n        abstract = True\n        model = models.Publication\n        fields = MasterModelSerializer.Meta.fields + (\n            'publisher',\n            'repository_version',\n            'repository'\n        )\n\n\nclass ContentGuardSerializer(MasterModelSerializer):\n    _href = DetailIdentityField()\n\n    name = serializers.CharField(\n        help_text=_('The unique name.')\n    )\n    description = serializers.CharField(\n        help_text=_('An optional description.'),\n        allow_null=True,\n        required=False\n    )\n\n    class Meta:\n        model = models.ContentGuard\n        fields = MasterModelSerializer.Meta.fields + (\n            'name',\n            'description'\n        )\n\n\nclass BaseDistributionSerializer(MasterModelSerializer):\n    \"\"\"\n    The Serializer for the BaseDistribution model.\n\n    The serializer deliberately omits the \"remote\" field, which is used for\n    pull-through caching only. Plugins implementing pull-through caching will\n    have to add the field in their derived serializer class like this::\n\n      remote = DetailRelatedField(\n          required=False,\n          help_text=_('Remote that can be used to fetch content when using pull-through caching.'),\n          queryset=models.Remote.objects.all(),\n          allow_null=True\n      )\n\n    \"\"\"\n\n    _href = DetailIdentityField()\n    base_path = serializers.CharField(\n        help_text=_('The base (relative) path component of the published url. Avoid paths that \\\n                    overlap with other distribution base paths (e.g. \"foo\" and \"foo/bar\")'),\n        validators=[validators.MaxLengthValidator(\n            models.BaseDistribution._meta.get_field('base_path').max_length,\n            message=_('`base_path` length must be less than {} characters').format(\n                models.BaseDistribution._meta.get_field('base_path').max_length\n            )),\n            UniqueValidator(queryset=models.BaseDistribution.objects.all()),\n        ]\n    )\n    base_url = BaseURLField(\n        source='base_path', read_only=True,\n        help_text=_('The URL for accessing the publication as defined by this distribution.')\n    )\n    content_guard = DetailRelatedField(\n        required=False,\n        help_text=_('An optional content-guard.'),\n        queryset=models.ContentGuard.objects.all(),\n        allow_null=True\n    )\n    name = serializers.CharField(\n        help_text=_('A unique name. Ex, `rawhide` and `stable`.'),\n        validators=[validators.MaxLengthValidator(\n            models.BaseDistribution._meta.get_field('name').max_length,\n            message=_('`name` length must be less than {} characters').format(\n                models.BaseDistribution._meta.get_field('name').max_length\n            )),\n            UniqueValidator(queryset=models.BaseDistribution.objects.all())]\n    )\n\n    class Meta:\n        abstract = True\n        model = models.BaseDistribution\n        fields = ModelSerializer.Meta.fields + (\n            'base_path',\n            'base_url',\n            'content_guard',\n            'name',\n        )\n\n    def _validate_path_overlap(self, path):\n        # look for any base paths nested in path\n        search = path.split(\"/\")[0]\n        q = Q(base_path=search)\n        for subdir in path.split(\"/\")[1:]:\n            search = \"/\".join((search, subdir))\n            q |= Q(base_path=search)\n\n        # look for any base paths that nest path\n        q |= Q(base_path__startswith='{}/'.format(path))\n        qs = models.BaseDistribution.objects.filter(q)\n\n        if self.instance is not None:\n            qs = qs.exclude(pk=self.instance.pk)\n\n        match = qs.first()\n        if match:\n            raise serializers.ValidationError(detail=_(\"Overlaps with existing distribution '\"\n                                                       \"{}'\").format(match.name))\n\n        return path\n\n    def validate_base_path(self, path):\n        self._validate_relative_path(path)\n        return self._validate_path_overlap(path)\n\n\nclass PublicationDistributionSerializer(BaseDistributionSerializer):\n    publication = DetailRelatedField(\n        required=False,\n        help_text=_('Publication to be served'),\n        queryset=models.Publication.objects.exclude(complete=False),\n        allow_null=True\n    )\n\n    class Meta:\n        abstract = True\n        fields = BaseDistributionSerializer.Meta.fields + (\n            'publication',\n        )\n\n\nclass RepositoryVersionDistributionSerializer(BaseDistributionSerializer):\n    repository = RelatedField(\n        required=False,\n        help_text=_('The latest RepositoryVersion for this Repository will be served.'),\n        queryset=models.Repository.objects.all(),\n        view_name='repositories-detail',\n        allow_null=True\n    )\n    repository_version = NestedRelatedField(\n        required=False,\n        help_text=_('RepositoryVersion to be served'),\n        queryset=models.RepositoryVersion.objects.exclude(complete=False),\n        view_name='versions-detail',\n        allow_null=True,\n        lookup_field='number',\n        parent_lookup_kwargs={'repository_pk': 'repository__pk'},\n    )\n\n    class Meta:\n        abstract = True\n        fields = BaseDistributionSerializer.Meta.fields + (\n            'repository',\n            'repository_version',\n        )\n\n    def validate(self, data):\n        super().validate(data)\n\n        repository_in_data = 'repository' in data\n        repository_version_in_data = 'repository_version' in data\n        repository_in_instance = self.instance.repository if self.instance else None\n        repository_version_in_instance = self.instance.repository_version if self.instance else None\n\n        if repository_in_data and repository_version_in_data:\n            error = True\n        elif repository_in_data and repository_version_in_instance:\n            error = True\n        elif repository_in_instance and repository_version_in_data:\n            error = True\n        else:\n            error = False\n\n        if error:\n            msg = _(\"The attributes 'repository' and 'repository_version' must be used\"\n                    \" exclusively.\")\n            raise serializers.ValidationError(msg)\n\n        return data\n", "path": "pulpcore/app/serializers/publication.py"}]}