Change in vdsm[master]: janitorial: add the response.success() helper
fromani at redhat.com
fromani at redhat.com
Fri Mar 6 08:37:08 UTC 2015
Francesco Romani has posted comments on this change.
Change subject: janitorial: add the response.success() helper
......................................................................
Patch Set 5:
(3 comments)
https://gerrit.ovirt.org/#/c/38270/5/lib/vdsm/response.py
File lib/vdsm/response.py:
Line 21:
Line 22: from vdsm.define import doneCode, errCode
Line 23:
Line 24:
Line 25: def success(**kwargs):
> Possible alternatives:
ok() is nice but maybe too short. However, it is just my taste, so there is plenty of room for discussion.
done() seems too generic to me.
Line 26: res = {'status': doneCode}
Line 27: res.update(kwargs)
Line 28: return res
Line 29:
Line 22: from vdsm.define import doneCode, errCode
Line 23:
Line 24:
Line 25: def success(**kwargs):
Line 26: res = {'status': doneCode}
> This return mutable dict in doneCode - unsafe. Should create new status dic
Yes, my bad. Will fix.
Line 27: res.update(kwargs)
Line 28: return res
Line 29:
Line 30:
Line 23:
Line 24:
Line 25: def success(**kwargs):
Line 26: res = {'status': doneCode}
Line 27: res.update(kwargs)
> This may override status if you do:
Will change as you suggest.
Line 28: return res
Line 29:
Line 30:
Line 31: def error(name, message=None):
--
To view, visit https://gerrit.ovirt.org/38270
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5fcd6c832f3a16a543357570c591c1f9a907c97a
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list