[Patchew-devel] [PATCH] rest: relieve some constraints on results

Paolo Bonzini posted 1 patch 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew-ci next tags/patchew/20181128083244.9383-1-pbonzini@redhat.com
api/rest.py | 2 +-
mods/git.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)

[Patchew-devel] [PATCH] rest: relieve some constraints on results

Posted by Paolo Bonzini 1 week ago
Logs are optional, and the git base should not be present if pending
or running.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 api/rest.py | 2 +-
 mods/git.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/api/rest.py b/api/rest.py
index 817f30f..573cbf1 100644
--- a/api/rest.py
+++ b/api/rest.py
@@ -565,7 +565,7 @@ class ResultSerializerFull(ResultSerializer):
         read_only_fields = ResultSerializer.Meta.read_only_fields
 
     # The database field is log_xz, so this is needed here
-    log = CharField(required=False)
+    log = CharField(required=False, allow_null=True, allow_blank=True)
 
 
 class ResultsViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin,
diff --git a/mods/git.py b/mods/git.py
index a37de57..2c17fc1 100644
--- a/mods/git.py
+++ b/mods/git.py
@@ -45,7 +45,8 @@ class GitLogViewer(LogView):
         return obj.git_result
 
 class ResultDataSerializer(serializers.Serializer):
-    base = CharField()
+    # TODO: should be present iff the result is success or failure
+    base = CharField(required=False)
 
     # TODO: should be present iff the result is a success
     repo = CharField(required=False)
-- 
2.19.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel

Re: [Patchew-devel] [PATCH] rest: relieve some constraints on results

Posted by Caio Carrara 1 week ago
On Wed, Nov 28, 2018 at 09:32:44AM +0100, Paolo Bonzini wrote:
> Logs are optional, and the git base should not be present if pending
> or running.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Caio Carrara <ccarrara@redhat.com>

> ---
>  api/rest.py | 2 +-
>  mods/git.py | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/api/rest.py b/api/rest.py
> index 817f30f..573cbf1 100644
> --- a/api/rest.py
> +++ b/api/rest.py
> @@ -565,7 +565,7 @@ class ResultSerializerFull(ResultSerializer):
>          read_only_fields = ResultSerializer.Meta.read_only_fields
>  
>      # The database field is log_xz, so this is needed here
> -    log = CharField(required=False)
> +    log = CharField(required=False, allow_null=True, allow_blank=True)
>  
>  
>  class ResultsViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin,
> diff --git a/mods/git.py b/mods/git.py
> index a37de57..2c17fc1 100644
> --- a/mods/git.py
> +++ b/mods/git.py
> @@ -45,7 +45,8 @@ class GitLogViewer(LogView):
>          return obj.git_result
>  
>  class ResultDataSerializer(serializers.Serializer):
> -    base = CharField()
> +    # TODO: should be present iff the result is success or failure

Well, perhaps instead of a comment implement the proper validation. I'm
ok to do it in a next patch refactoring it.

> +    base = CharField(required=False)
>  
>      # TODO: should be present iff the result is a success
>      repo = CharField(required=False)
> -- 
> 2.19.1
> 
> _______________________________________________
> Patchew-devel mailing list
> Patchew-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/patchew-devel

-- 
Caio Carrara
Software Engineer, Virt Team - Red Hat
ccarrara@redhat.com

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel