Beispiel #1
0
class ReleaseSerializer(serializers.Serializer):
    ref = serializers.CharField(max_length=VERSION_LENGTH, required=False)
    url = serializers.URLField(required=False)
    dateReleased = serializers.DateTimeField(required=False)
    commits = ListField(child=CommitSerializer(),
                        required=False,
                        allow_null=False)
class ReleaseSerializer(serializers.Serializer):
    ref = serializers.CharField(max_length=64, required=False)
    url = serializers.URLField(required=False)
    dateStarted = serializers.DateTimeField(required=False)
    dateReleased = serializers.DateTimeField(required=False)
    commits = ListField(child=CommitSerializer(), required=False)
    head_commits = ListField(child=ReleaseHeadCommitSerializer(),
                             required=False)
Beispiel #3
0
class ReleaseSerializer(serializers.Serializer):
    version = serializers.RegexField(r'^[a-zA-Z0-9\-_\. \(\)]+\Z',
                                     max_length=64,
                                     required=True)
    ref = serializers.CharField(max_length=64, required=False)
    url = serializers.URLField(required=False)
    owner = UserField(required=False)
    dateStarted = serializers.DateTimeField(required=False)
    dateReleased = serializers.DateTimeField(required=False)
    commits = ListField(child=CommitSerializer(), required=False)
Beispiel #4
0
class ReleaseSerializer(serializers.Serializer):
    version = serializers.CharField(max_length=64, required=True)
    ref = serializers.CharField(max_length=64, required=False)
    url = serializers.URLField(required=False)
    owner = UserField(required=False)
    dateReleased = serializers.DateTimeField(required=False)
    commits = ListField(child=CommitSerializer(), required=False)

    def validate_version(self, attrs, source):
        value = attrs[source]
        if any(c in value for c in BAD_RELEASE_CHARS) or value in ('.', '..'):
            raise serializers.ValidationError('Invalid value for release')
        return attrs
class ReleaseSerializer(serializers.Serializer):
    ref = serializers.CharField(max_length=64, required=False)
    url = serializers.URLField(required=False)
    dateReleased = serializers.DateTimeField(required=False)
    commits = ListField(child=CommitSerializer(), required=False, allow_null=False)
    headCommits = ListField(
        child=ReleaseHeadCommitSerializerDeprecated(), required=False, allow_null=False
    )
    refs = ListField(
        child=ReleaseHeadCommitSerializer(),
        required=False,
        allow_null=False,
    )
Beispiel #6
0
class ReleaseSerializer(serializers.Serializer):
    version = serializers.CharField(max_length=VERSION_LENGTH, required=True)
    ref = serializers.CharField(max_length=VERSION_LENGTH, required=False)
    url = serializers.URLField(required=False)
    owner = UserField(required=False)
    dateReleased = serializers.DateTimeField(required=False)
    commits = ListField(child=CommitSerializer(), required=False, allow_null=False)

    def validate_version(self, attrs, source):
        value = attrs[source]
        if not Release.is_valid_version(value):
            raise serializers.ValidationError('Invalid value for release')
        return attrs
Beispiel #7
0
class ReleaseSerializer(serializers.Serializer):
    ref = serializers.CharField(
        max_length=MAX_VERSION_LENGTH, required=False, allow_null=True, allow_blank=True
    )
    url = serializers.URLField(required=False, allow_null=True, allow_blank=True)
    dateReleased = serializers.DateTimeField(required=False, allow_null=True)
    commits = ListField(child=CommitSerializer(), required=False, allow_null=False)

    status = serializers.CharField(required=False, allow_null=False)

    def validate_status(self, value):
        try:
            return ReleaseStatus.from_string(value)
        except ValueError:
            raise serializers.ValidationError("Invalid status %s" % value)
Beispiel #8
0
class ReleaseSerializer(serializers.Serializer):
    version = serializers.RegexField(r'[a-zA-Z0-9\-_\.]',
                                     max_length=64,
                                     required=True)
    ref = serializers.CharField(max_length=64, required=False)
    url = serializers.URLField(required=False)
    owner = UserField(required=False)
    dateStarted = serializers.DateTimeField(required=False)
    dateReleased = serializers.DateTimeField(required=False)
    commits = ListField(child=CommitSerializer(), required=False)

    def validate_version(self, attrs, source):
        value = attrs[source]
        if not set(value).isdisjoint(set(string.whitespace)):
            raise serializers.ValidationError('Enter a valid value')
        return attrs