From e617801d26f11513b71b0fcd5a7385938d1915ef Mon Sep 17 00:00:00 2001 From: Yasin Date: Fri, 15 Nov 2013 18:31:13 +0100 Subject: [PATCH] genkey/upkey works even if there is no user_hrn --- portal/accountview.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/portal/accountview.py b/portal/accountview.py index 646ea2c5..f7fa1b8d 100644 --- a/portal/accountview.py +++ b/portal/accountview.py @@ -171,7 +171,7 @@ def account_process(request): # updating maniolf local:account table account_config = json.loads(account_detail['config']) # preserving user_hrn - user_hrn = account_config['user_hrn'] + user_hrn = account_config.get('user_hrn','N/A') keypair = '{"user_public_key":'+ public_key + ', "user_private_key":'+ private_key + ', "user_hrn":"'+ user_hrn + '"}' updated_config = json.dumps(account_config) @@ -196,7 +196,7 @@ def account_process(request): if file_extension in allowed_extension and re.search(r'ssh-rsa',file_content): account_config = json.loads(account_detail['config']) # preserving user_hrn - user_hrn = account_config['user_hrn'] + user_hrn = account_config.get('user_hrn','N/A') file_content = '{"user_public_key":"'+ file_content + '", "user_hrn":"'+ user_hrn +'"}' #file_content = re.sub("\r", "", file_content) #file_content = re.sub("\n", "\\n",file_content) -- 2.43.0