[Kimchi-devel] [kimchi-devel][PATCH 4/5] Update controller to make update accept formdata params
lvroyce at linux.vnet.ibm.com
lvroyce at linux.vnet.ibm.com
Wed Jan 7 09:01:08 UTC 2015
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 | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py
index f1449ea..5ec8dc8 100644
--- a/src/kimchi/control/base.py
+++ b/src/kimchi/control/base.py
@@ -143,7 +143,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)
@@ -154,7 +154,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:
@@ -162,7 +162,6 @@ class Resource(object):
except UnauthorizedError, e:
raise cherrypy.HTTPError(403, e.message)
except NotFoundError, e:
- raise
raise cherrypy.HTTPError(404, e.message)
except OperationFailed, e:
raise cherrypy.HTTPError(500, e.message)
@@ -182,7 +181,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:
--
1.9.3
More information about the Kimchi-devel
mailing list