[Kimchi-devel] [PATCH][Wok] Fix notification api message return

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Sun May 29 23:08:40 UTC 2016


When Wok receives a notifications request, it is using "pop" to retrieve
plugin name. This actions removes plugin entry from the dictionary, so
in next request it is not able to know what plugin is, then message is
not returned, just {"CODE": "CODE"}.
This patch fixes this problem.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 src/wok/model/notifications.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wok/model/notifications.py b/src/wok/model/notifications.py
index 55bd178..e83ac56 100644
--- a/src/wok/model/notifications.py
+++ b/src/wok/model/notifications.py
@@ -72,8 +72,8 @@ class NotificationModel(object):
 
         # use WokMessage to translate the notification
         if notification:
-            timestamp = notification['timestamp']
-            plugin = notification.pop('_plugin_name', None)
+            timestamp = notification.get('timestamp', None)
+            plugin = notification.get('_plugin_name', None)
             message = WokMessage(str(id), notification, plugin).get_text()
             return {"code": id, "message": message, "timestamp": timestamp}
 
-- 
2.1.0




More information about the Kimchi-devel mailing list