[Kimchi-devel] [PATCH] [Wok] Update AsyncResource class with delete method.
pvital at linux.vnet.ibm.com
pvital at linux.vnet.ibm.com
Thu Apr 14 19:03:36 UTC 2016
From: Paulo Vital <pvital at linux.vnet.ibm.com>
Added the method delete to AysncResource class to be able to execute DELETE
requests as AsyncTask.
This patch is part of solution to Kimchi issue #817
Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
src/wok/control/base.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 25f6522..7aeb844 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -294,6 +294,22 @@ class AsyncResource(Resource):
cherrypy.response.status = 202
return wok.template.render('Task', self.info)
+ def delete(self):
+ try:
+ fn = getattr(self.model, model_fn(self, 'delete'))
+ task = fn(*self.model_args)
+ except AttributeError:
+ e = InvalidOperation('WOKAPI0002E', {'resource':
+ get_class_name(self)})
+ raise cherrypy.HTTPError(405, e.message)
+ except OperationFailed, e:
+ raise cherrypy.HTTPError(500, e.message)
+ except InvalidOperation, e:
+ raise cherrypy.HTTPError(400, e.message)
+
+ cherrypy.response.status = 202
+ return wok.template.render("Task", task)
+
class Collection(object):
"""
--
2.5.5
More information about the Kimchi-devel
mailing list