From: lombardof Date: Thu, 10 May 2018 17:00:49 +0000 (+0200) Subject: bug fix additional_conf on json parsing X-Git-Tag: v4.0.0~5 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=04c0dc7e468e2f3723bc7f67ea56a9c1c27dba23;p=osm%2FLW-UI.git bug fix additional_conf on json parsing Change-Id: I1ff19c495eebd530d033ccc2379d0e70d72a0322 Signed-off-by: lombardof --- 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)