From: Yasin Date: Fri, 15 Nov 2013 17:31:13 +0000 (+0100) Subject: genkey/upkey works even if there is no user_hrn X-Git-Tag: myslice-0.3-0~113^2~7^2~7^2~1 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=e617801d26f11513b71b0fcd5a7385938d1915ef genkey/upkey works even if there is no user_hrn --- 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)