[Kimchi-devel] [kimchi-devel][PATCHv3 2/6] Update controller to make update accept formdata params
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Feb 9 14:34:53 UTC 2015
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 28/01/2015 11:20, 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 484e9b9..1a40af8 100644
> --- a/src/kimchi/control/base.py
> +++ b/src/kimchi/control/base.py
> @@ -151,7 +151,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)
>
> @@ -162,7 +162,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:
> @@ -189,7 +189,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