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

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Wed Jan 28 13:20:27 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 | 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:
-- 
2.1.0




More information about the Kimchi-devel mailing list