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

Lucio Correia luciojhc at linux.vnet.ibm.com
Mon May 30 14:18:13 UTC 2016


Reviewed-By: Lucio Correia <luciojhc at 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 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}
>


-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list