[Kimchi-devel] [PATCH 2/3] Plugins: Fix api_schema for plugins framework

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Fri Jan 17 18:42:42 UTC 2014


On 01/16/2014 12:49 AM, Mark Wu wrote:
> On 01/15/2014 12:17 AM, Rodrigo Trujillo wrote:
>> Currently, the api_schema for the plugins have not been checked.
>> This patch fixes this problem getting the api_schema from the main
>> plugin class.
>>
>> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
>> ---
>>   src/kimchi/control/utils.py | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/kimchi/control/utils.py b/src/kimchi/control/utils.py
>> index c3c5f8e..676fa08 100644
>> --- a/src/kimchi/control/utils.py
>> +++ b/src/kimchi/control/utils.py
>> @@ -89,7 +89,9 @@ def internal_redirect(url):
>>   def validate_params(params, instance, action):
>>       root = cherrypy.request.app.root
>>
>> -    if hasattr(root, 'api_schema'):
>> +    if hasattr(instance, 'api_schema'):
>> +        api_schema = instance.api_schema
>> +    elif hasattr(root, 'api_schema'):
>>           api_schema = root.api_schema
>>       else:
>>           return
> I don't know how you get the conclusion that plugin's api schema 
> validation doesn't
> When you make request to the plugin app, cherrypy.request.app.root is 
> the instance of plugin class.
> In sample plugin,  it's plugins.sample.Drawings.   You could can add a 
> print statement to verify it.
>
> And the test cases in test_plugin.py also can verify the api schema work.
You are right, made new tests and it works :)
Just sent another patch (v2), without this modifications.
Thanks Mark
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>




More information about the Kimchi-devel mailing list