[PATCH] Fix pwclient get on Python 2
Daniel Axtens
dja at axtens.net
Mon May 22 21:57:07 AEST 2017
Hi,
So I only saw Robin's one after I sent this - Stephen, up to you what
you want to pick.
In the long run we probably want to port this to REST and drop XMLRPC.
Regards,
Daniel
Daniel Axtens <dja at axtens.net> writes:
> Forcibly convert to unicode on Python 2 only.
>
> This makes 'pwclient get' work on both Python 2 and Python 3.
>
> Signed-off-by: Daniel Axtens <dja at axtens.net>
> ---
> patchwork/bin/pwclient | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient
> index 5fcb0844b923..8c26fdb6d876 100755
> --- a/patchwork/bin/pwclient
> +++ b/patchwork/bin/pwclient
> @@ -303,6 +303,11 @@ def action_get(rpc, patch_id):
> fname = "%s.%d" % (base_fname, i)
> i += 1
>
> + try:
> + s = unicode(s)
> + except NameError:
> + pass
> +
> with io.open(fname, 'w', encoding='utf-8') as f:
> f.write(s)
> print('Saved patch to %s' % fname)
> --
> 2.11.0
More information about the Patchwork
mailing list