[PATCH v3 09/10] REST API: expose patch.checks

Finucane, Stephen stephen.finucane at intel.com
Thu May 19 19:36:42 AEST 2016


On 18 May 22:31, Andy Doan wrote:
> Signed-off-by: Andy Doan <andy.doan at linaro.org>
> ---
>  patchwork/rest_serializers.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/patchwork/rest_serializers.py b/patchwork/rest_serializers.py
> index 801978c..1ef6df1 100644
> --- a/patchwork/rest_serializers.py
> +++ b/patchwork/rest_serializers.py
> @@ -60,6 +60,7 @@ class PatchSerializer(ModelSerializer):
>          read_only_fields = ('project', 'name', 'date', 'submitter', 'diff',
>                              'content', 'hash', 'msgid')
>      mbox_url = SerializerMethodField()
> +    check_names = dict(Check.STATE_CHOICES)
>  
>      def run_validation(self, data):
>          state = data.get('state')
> @@ -75,6 +76,7 @@ class PatchSerializer(ModelSerializer):
>          data = super(PatchSerializer, self).to_representation(instance)
>  
>          data['state'] = instance.state.name
> +        data['checks'] = self.check_names[instance.combined_check_state]

s/checks/check/

Also, I think we should embed a 'checks_url' to point to
'patch/{patchID}/checks'?

>  
>          data['mbox_url'] = request.build_absolute_uri(data['mbox_url'])
>          data['project'] = request.build_absolute_uri(
> -- 
> 2.7.4
> 
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork


More information about the Patchwork mailing list