[Kimchi-devel] [PATCH][Wok] Expose delete notification function
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Sat May 28 21:16:49 UTC 2016
This patch exposes the delete notifications operation, then plugins can
use the function directly instead of import and instanciate the model to
make this operation.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
src/wok/model/notifications.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/wok/model/notifications.py b/src/wok/model/notifications.py
index 79bed03..55bd178 100644
--- a/src/wok/model/notifications.py
+++ b/src/wok/model/notifications.py
@@ -44,6 +44,15 @@ def add_notification(code, args={}, plugin_name=None):
notificationsStore[code] = args
+def del_notification(code):
+ global notificationsStore
+
+ try:
+ del notificationsStore[str(code)]
+ except Exception as e:
+ raise OperationFailed("WOKNOT0002E", {'id': str(code), 'msg': e.msg()})
+
+
class NotificationsModel(object):
def __init__(self, **kargs):
pass
@@ -71,10 +80,4 @@ class NotificationModel(object):
raise NotFoundError("WOKNOT0001E", {'id': str(id)})
def delete(self, id):
- global notificationsStore
-
- try:
- del notificationsStore[str(id)]
- except Exception as e:
- raise OperationFailed("WOKNOT0002E", {'id': str(id),
- 'msg': e.msg()})
+ del_notification(id)
--
2.1.0
More information about the Kimchi-devel
mailing list