Dan Kenigsberg has submitted this change and it was merged.
Change subject: guestagent: Add note about unneeded encoding
......................................................................
guestagent: Add note about unneeded encoding
In Python 2, the output of json.dumps() is always a str object, and is
using ascii charset by default. Encoding the output will first decode it
to unicode using the system default encoding (ascii), and then encode it
back to utf8, which will create the same string.
>>> json.dumps({u"\u05d0": u"\u05d1"})
'{"\\u05d0": "\\u05d1"}'
>>> json.dumps({u"\u05d0": u"\u05d1"}).encode('utf8')
'{"\\u05d0": "\\u05d1"}'
However, on Python 3 this encoding is needed, since json.dumps returns
str object, and sockets requires bytes object. Add note about using a
wrapper to hide the difference.
Change-Id: I95e0875d6a2428714e9d979cb9db34a6399f4623
Signed-off-by: Nir Soffer <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/49338
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <[email protected]>
Reviewed-by: Vinzenz Feenstra <[email protected]>
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M vdsm/virt/guestagent.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Nir Soffer: Verified
Jenkins CI: Passed CI tests
Vinzenz Feenstra: Looks good to me, but someone else must approve
Dan Kenigsberg: Looks good to me, approved
Francesco Romani: Looks good to me, but someone else must approve
--
To view, visit https://gerrit.ovirt.org/49338
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I95e0875d6a2428714e9d979cb9db34a6399f4623
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Milan Zamazal <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: gerrit-hooks <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches