Francesco Romani has uploaded a new change for review. Change subject: lib: api.py: preserve signature in decorator ......................................................................
lib: api.py: preserve signature in decorator The api.method decorator needs to preserve the function or method signature, to let the schema validation keep working. Moreover, preserving the signature of decorated callables is a good idea anyway. In python 3.4+ this is done by default, but on python 2.7 we need to take steps to implement this. We leverage the existing 'decorator' module which solves this problem. This module is available in EL/Centos7. For further reference: http://blog.dscpl.com.au/2014/01/how-you-implemented-your-python.html http://www.phyast.pitt.edu/~micheles/python/documentation.html Change-Id: I06205cf180229ea19ffc38a7b88346afc18f13e4 Signed-off-by: Francesco Romani <from...@redhat.com> --- M lib/vdsm/common/api.py M vdsm.spec.in 2 files changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/63759/1 diff --git a/lib/vdsm/common/api.py b/lib/vdsm/common/api.py index 354b665..76a75c3 100644 --- a/lib/vdsm/common/api.py +++ b/lib/vdsm/common/api.py @@ -22,6 +22,8 @@ from functools import wraps import logging +from decorator import decorator + from vdsm import exception from vdsm import response @@ -29,6 +31,7 @@ _log = logging.getLogger("virt.api") +@decorator def method(func): """ Decorate an instance method, and return a response according to the diff --git a/vdsm.spec.in b/vdsm.spec.in index 26c36d3..7af1036 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -136,6 +136,7 @@ Requires: ntp Requires: iproute >= 3.10.0 Requires: PyYAML +Requires: python-decorator Requires: python-netaddr Requires: python-inotify Requires: python-argparse -- To view, visit https://gerrit.ovirt.org/63759 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I06205cf180229ea19ffc38a7b88346afc18f13e4 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <from...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org