Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES/+no-arch-all-validation.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added validation that prevents users from creating ReleaseArchitecture content for the special value "Architecture: all".
If you have previously created the content unit you can keep using it.
10 changes: 10 additions & 0 deletions pulp_deb/app/serializers/content_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,16 @@ class ReleaseArchitectureSerializer(NoArtifactContentSerializer):
help_text="Architecture variant name, if this architecture is a variant.",
)

def validate(self, data):
"""
Ensure we do not create a ReleaseArchitecture object for special value 'all'.
"""
data = super().validate(data)
if data.get("architecture") == "all":
message = "This field does not accept the special value 'all'!"
raise ValidationError({"architecture": _(message)})
return data

def get_unique_together_validators(self):
"""
We do not want UniqueTogetherValidator since we have retrieve logic!
Expand Down
Loading