[Kimchi-devel] [PATCH] GET /plugins failed, fix it
Sheldon
shaohef at linux.vnet.ibm.com
Mon Jan 27 16:39:04 UTC 2014
On 01/27/2014 11:43 PM, Shu Ming wrote:
> NACK
>
> See comments below.
> 2014/1/27 23:14, shaohef at linux.vnet.ibm.com:
>> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>>
>> commit 478d01d add a more parameter "filter_params" for get method of
>> collection.
>>
>> But it does not add this new parameter to derived class.
>>
>> $ curl -H "Content-Type: application/json" -H "Accept:
>> application/json" \
>> http://localhost:8000/plugins
>>
>> Error as follow:
>>
>> [27/Jan/2014:23:01:50] HTTP Traceback (most recent call last):
>> File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line
>> 656, in respond
>> response.body = self.handler()
>> File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line
>> 188, in __call__
>> self.body = self.oldhandler(*args, **kwargs)
>> File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line
>> 34, in __call__
>> return self.callable(*self.args, **self.kwargs)
>> File "/home/shhfeng/work/workdir/kimchi/src/kimchi/control/base.py",
>> line 266, in index
>> return self.get(filter_params)
>> TypeError: get() takes exactly 1 argument (2 given)
>>
>> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>> ---
>> src/kimchi/control/plugins.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/kimchi/control/plugins.py
>> b/src/kimchi/control/plugins.py
>> index 5938085..1221342 100644
>> --- a/src/kimchi/control/plugins.py
>> +++ b/src/kimchi/control/plugins.py
>> @@ -37,7 +37,7 @@ class Plugins(Collection):
>> def data(self):
>> return self.info
>>
>> - def get(self):
>> + def get(self, *args):
>> res_list = []
>> try:
>> get_list = getattr(self.model, model_fn(self, 'get_list'))
> I am not sure how *args will be used in get().
>
>
it will not be used in this derived class. It will use in some other
derived class.
But we did need a argument here.
I can define it as
def get(self, filter_pararms):
but filter_pararms will net be used here.
so *args is more better.
$ git show 478d01d
will tell why we need *args here.
>
>
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center
More information about the Kimchi-devel
mailing list