[Kimchi-devel] [kimchi-devel][PATCHv4 2/7] Update controller to make update accept formdata params

Aline Manera alinefm at linux.vnet.ibm.com
Mon May 4 19:35:25 UTC 2015


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 22/04/2015 05:02, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> When update does not accept params in base class,
> cherrypy will raise error that extra params are provided in body.
> So allow update function to accept params.
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
>   src/kimchi/control/base.py | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py
> index b50ea5c..b9520c0 100644
> --- a/src/kimchi/control/base.py
> +++ b/src/kimchi/control/base.py
> @@ -156,7 +156,7 @@ class Resource(object):
>               raise cherrypy.HTTPError(400, e.message)
>
>       @cherrypy.expose
> -    def index(self):
> +    def index(self, *args, **kargs):
>           method = validate_method(('GET', 'DELETE', 'PUT'),
>                                    self.role_key, self.admin_methods)
>
> @@ -167,7 +167,7 @@ class Resource(object):
>
>               return {'GET': self.get,
>                       'DELETE': self.delete,
> -                    'PUT': self.update}[method]()
> +                    'PUT': self.update}[method](*args, **kargs)
>           except InvalidOperation, e:
>               raise cherrypy.HTTPError(400, e.message)
>           except InvalidParameter, e:
> @@ -194,7 +194,7 @@ class Resource(object):
>
>           return user_name in users or len(set(user_groups) & set(groups)) > 0
>
> -    def update(self):
> +    def update(self, *args, **kargs):
>           try:
>               update = getattr(self.model, model_fn(self, 'update'))
>           except AttributeError:




More information about the Kimchi-devel mailing list