[PATCH][Wok] Fix notification api message return

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@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

Reviewed-By: Lucio Correia <luciojhc@linux.vnet.ibm.com> On 29-05-2016 20:08, Rodrigo Trujillo wrote:
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@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}
-- Lucio Correia Software Engineer IBM LTC Brazil
participants (2)
-
Lucio Correia
-
Rodrigo Trujillo