From 04c0dc7e468e2f3723bc7f67ea56a9c1c27dba23 Mon Sep 17 00:00:00 2001 From: lombardof Date: Thu, 10 May 2018 19:00:49 +0200 Subject: [PATCH] bug fix additional_conf on json parsing Change-Id: I1ff19c495eebd530d033ccc2379d0e70d72a0322 Signed-off-by: lombardof --- vimhandler/views.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vimhandler/views.py b/vimhandler/views.py index d350704..880cf3f 100644 --- a/vimhandler/views.py +++ b/vimhandler/views.py @@ -58,10 +58,14 @@ def create(request): config_key = k[7:] vim_data['config'][config_key] = v if 'additional_conf' in new_vim_dict: - additional_conf_dict = json.loads(new_vim_dict['additional_conf']) - for k,v in additional_conf_dict.items(): - vim_data['config'][k] = v - print vim_data + try: + additional_conf_dict = json.loads(new_vim_dict['additional_conf']) + for k,v in additional_conf_dict.items(): + vim_data['config'][k] = v + except Exception as e: + # TODO return error on json.loads exception + print e + result = client.vim_create(vim_data) # TODO 'vim:show', to_redirect=True, vim_id=vim_id return __response_handler(request, result, 'vim:list', to_redirect=True) -- 2.25.1