diff --git a/ledgergw/api.py b/ledgergw/api.py index 77fcf23ed..53143f6db 100644 --- a/ledgergw/api.py +++ b/ledgergw/api.py @@ -302,12 +302,12 @@ def update_user_info_id(request, userid,apikey): if ledger_obj.postal_address.country != postal_address_obj['postal_country']: models.EmailUserChangeLog.objects.create(emailuser=ledger_user[0], change_key="postal_country", change_value="ledger_api_client_"+api_key_obj_update_key+": " +ledgergw_utils.remove_html_tags(postal_address_obj['postal_country']),change_by=ledger_changeuser_obj) ledger_obj.postal_address.country = ledgergw_utils.remove_html_tags(postal_address_obj['postal_country']) - - if 'postal_same_as_residential' in postal_address_obj: - if ledger_obj.postal_same_as_residential != postal_address_obj['postal_same_as_residential']: - models.EmailUserChangeLog.objects.create(emailuser=ledger_user[0], change_key="postal_same_as_residential", change_value="ledger_api_client_"+api_key_obj_update_key+": " +str(postal_address_obj['postal_same_as_residential']),change_by=ledger_changeuser_obj) - if isinstance(postal_address_obj['postal_same_as_residential'], bool): - ledger_obj.postal_same_as_residential = postal_address_obj['postal_same_as_residential'] + if 'postal_same_as_residential' in postal_address_obj: + if ledger_obj.postal_same_as_residential != postal_address_obj['postal_same_as_residential']: + models.EmailUserChangeLog.objects.create(emailuser=ledger_user[0], change_key="postal_same_as_residential", change_value="ledger_api_client_"+api_key_obj_update_key+": " +str(postal_address_obj['postal_same_as_residential']),change_by=ledger_changeuser_obj) + if isinstance(postal_address_obj['postal_same_as_residential'], bool): + ledger_obj.postal_same_as_residential = postal_address_obj['postal_same_as_residential'] + ledger_obj.postal_address.save() except Exception as e: print (str(e)) @@ -2514,4 +2514,4 @@ def check_oracle_code(request,apikey): # print(traceback.print_exc()) # raise - \ No newline at end of file + diff --git a/ledgergw/management/commands/cba_sync.py b/ledgergw/management/commands/cba_sync.py index 2014f6f94..88d8940ba 100644 --- a/ledgergw/management/commands/cba_sync.py +++ b/ledgergw/management/commands/cba_sync.py @@ -40,7 +40,7 @@ def handle(self, *args, **options): print ("removing "+lbf) os.remove(local_bank_directory+lbf) - result = subprocess.check_output('echo "ls '+remote_bank_directory+'" | sftp -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i /tmp/bank.key '+sftp_username+'@'+sftp_host, shell=True, text=True) + result = subprocess.check_output('echo "ls '+remote_bank_directory+'" | sftp -o Ciphers=aes256-ctr -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i /tmp/bank.key '+sftp_username+'@'+sftp_host, shell=True, text=True) sftpfiles = result.split("\n") for file in sftpfiles: sftp_file = file.strip() @@ -53,7 +53,7 @@ def handle(self, *args, **options): print ("File already exists not downloading "+file_only) else: print ('downloading file '+file_only) - get_resp = subprocess.check_output('echo "get '+sftp_file+' '+local_bank_directory+'" | sftp -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i /tmp/bank.key '+sftp_username+'@'+sftp_host, shell=True, text=True) + get_resp = subprocess.check_output('echo "get '+sftp_file+' '+local_bank_directory+'" | sftp -o Ciphers=aes256-ctr -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i /tmp/bank.key '+sftp_username+'@'+sftp_host, shell=True, text=True) #print (get_resp) os.remove('/tmp/bank.key') except Exception as e: