@@ -742,7 +742,7 @@ def put(nr, *args, **kwargs):
742
742
return make_response (jsonify (message = 'Data does not include a name choice 1' ), 400 )
743
743
if not name_choice_exists [2 ] and name_choice_exists [3 ]:
744
744
return make_response (jsonify (message = 'Data contains a name choice 3 without a name choice 2' ), 400 )
745
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
745
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
746
746
try :
747
747
existing_nr = RequestDAO .get_inprogress (user )
748
748
if existing_nr :
@@ -770,7 +770,7 @@ def put(nr, *args, **kwargs):
770
770
except Exception as e :
771
771
current_app .logger .debug (f"Error parsing expirationDate: { str (e )} " )
772
772
pass
773
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
773
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
774
774
# convert NWPTA dates to correct format
775
775
if json_input .get ('nwpta' , None ):
776
776
for region in json_input ['nwpta' ]:
@@ -789,7 +789,7 @@ def put(nr, *args, **kwargs):
789
789
reset = False
790
790
if nrd .furnished == RequestDAO .REQUEST_FURNISHED and json_input .get ('furnished' , None ) == 'N' :
791
791
reset = True
792
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
792
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
793
793
nrd .additionalInfo = convert_to_ascii (json_input .get ('additionalInfo' , None ))
794
794
nrd .consentFlag = json_input .get ('consentFlag' , None )
795
795
nrd .consent_dt = json_input .get ('consent_dt' , None )
@@ -828,11 +828,11 @@ def put(nr, *args, **kwargs):
828
828
nrd .previousRequestId = None
829
829
except KeyError :
830
830
nrd .previousRequestId = None
831
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
831
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
832
832
# if we're changing to a completed or cancelled state, clear reset flag on NR record
833
833
if state in State .COMPLETED_STATE + [State .CANCELLED ]:
834
834
nrd .hasBeenReset = False
835
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
835
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
836
836
# check if any of the Oracle db fields have changed, so we can send them back
837
837
is_changed__request = False
838
838
is_changed__previous_request = False
@@ -856,7 +856,7 @@ def put(nr, *args, **kwargs):
856
856
is_changed_consent = True
857
857
if nrd .consentFlag == 'R' :
858
858
queue_util .publish_email_notification (nrd .nrNum , 'CONSENT_RECEIVED' )
859
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
859
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
860
860
# Need this for a re-open
861
861
if nrd .stateCd != State .CONDITIONAL and is_changed__request_state :
862
862
nrd .consentFlag = None
@@ -867,7 +867,7 @@ def put(nr, *args, **kwargs):
867
867
### APPLICANTS ###
868
868
is_changed__applicant = False
869
869
is_changed__address = False
870
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
870
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
871
871
if nrd .applicants :
872
872
applicants_d = nrd .applicants [0 ]
873
873
orig_applicant = applicants_d .as_dict ()
@@ -895,7 +895,7 @@ def put(nr, *args, **kwargs):
895
895
applicants_d .postalCd = convert_to_ascii (appl .get ('postalCd' , None ))
896
896
applicants_d .stateProvinceCd = convert_to_ascii (appl .get ('stateProvinceCd' , None ))
897
897
applicants_d .countryTypeCd = convert_to_ascii (appl .get ('countryTypeCd' , None ))
898
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
898
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
899
899
# check if any of the Oracle db fields have changed, so we can send them back
900
900
if applicants_d .lastName != orig_applicant ['lastName' ]:
901
901
is_changed__applicant = True
@@ -931,12 +931,12 @@ def put(nr, *args, **kwargs):
931
931
is_changed__address = True
932
932
if applicants_d .countryTypeCd != orig_applicant ['countryTypeCd' ]:
933
933
is_changed__address = True
934
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
934
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
935
935
else :
936
936
applicants_d .delete_from_db ()
937
937
is_changed__applicant = True
938
938
is_changed__address = True
939
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
939
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
940
940
941
941
### END applicants ###
942
942
@@ -947,7 +947,7 @@ def put(nr, *args, **kwargs):
947
947
is_changed__name2 = False
948
948
is_changed__name3 = False
949
949
deleted_names = [False ] * 3
950
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
950
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
951
951
if len (nrd .names ) == 0 :
952
952
new_name_choice = Name ()
953
953
new_name_choice .nrId = nrd .id
@@ -956,23 +956,23 @@ def put(nr, *args, **kwargs):
956
956
new_name_choice .name = convert_to_ascii (new_name_choice .name )
957
957
958
958
nrd .names .append (new_name_choice )
959
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
959
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
960
960
for nrd_name in nrd .names :
961
961
962
962
orig_name = nrd_name .as_dict ()
963
963
964
964
for in_name in json_input .get ('names' , []):
965
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
965
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
966
966
if len (nrd .names ) < in_name ['choice' ]:
967
967
968
968
errors = names_schema .validate (in_name , partial = False )
969
969
if errors :
970
970
MessageServices .add_message (MessageServices .ERROR , 'names_validation' , errors )
971
971
# return make_response(jsonify(errors), 400
972
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
972
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
973
973
# don't save if the name is blank
974
974
if in_name .get ('name' ) and in_name .get ('name' ) != '' :
975
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
975
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
976
976
new_name_choice = Name ()
977
977
new_name_choice .nrId = nrd .id
978
978
new_name_choice .choice = in_name .get ('choice' )
@@ -999,7 +999,7 @@ def put(nr, *args, **kwargs):
999
999
is_changed__name3 = True
1000
1000
1001
1001
elif nrd_name .choice == in_name ['choice' ]:
1002
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1002
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1003
1003
errors = names_schema .validate (in_name , partial = False )
1004
1004
if errors :
1005
1005
MessageServices .add_message (MessageServices .ERROR , 'names_validation' , errors )
@@ -1020,48 +1020,48 @@ def put(nr, *args, **kwargs):
1020
1020
nrd_name .name = in_name .get ('name' )
1021
1021
nrd_name .state = in_name .get ('state' )
1022
1022
nrd_name .name = convert_to_ascii (nrd_name .name .upper ())
1023
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1023
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1024
1024
# set comments (existing or cleared)
1025
1025
if in_name .get ('comment' , None ) is not None :
1026
1026
1027
1027
# if there is a comment ID in data, just set it
1028
1028
if in_name ['comment' ].get ('id' , None ) is not None :
1029
1029
nrd_name .commentId = in_name ['comment' ].get ('id' )
1030
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1030
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1031
1031
1032
1032
# if no comment id, it's a new comment, so add it
1033
1033
else :
1034
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1034
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1035
1035
# no business case for this at this point - this code will never run
1036
1036
pass
1037
1037
1038
1038
else :
1039
1039
nrd_name .comment = None
1040
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1040
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1041
1041
# convert data to ascii, removing data that won't save to Oracle
1042
1042
# - also force uppercase
1043
1043
nrd_name .name = convert_to_ascii (nrd_name .name )
1044
1044
if (nrd_name .name is not None ):
1045
1045
nrd_name .name = nrd_name .name .upper ()
1046
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1046
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1047
1047
# check if any of the Oracle db fields have changed, so we can send them back
1048
1048
# - this is only for editing a name from the Edit NR section, NOT making a decision
1049
1049
if nrd_name .name != orig_name ['name' ]:
1050
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1050
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1051
1051
if nrd_name .choice == 1 :
1052
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1052
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1053
1053
is_changed__name1 = True
1054
1054
json_input ['comments' ].append ({'comment' : 'Name choice 1 changed from {0} to {1}'
1055
1055
.format (orig_name ['name' ], nrd_name .name )})
1056
1056
if nrd_name .choice == 2 :
1057
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1057
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1058
1058
is_changed__name2 = True
1059
1059
if not nrd_name .name :
1060
1060
deleted_names [nrd_name .choice - 1 ] = True
1061
1061
json_input ['comments' ].append ({'comment' : 'Name choice 2 changed from {0} to {1}'
1062
1062
.format (orig_name ['name' ], nrd_name .name )})
1063
1063
if nrd_name .choice == 3 :
1064
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1064
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1065
1065
is_changed__name3 = True
1066
1066
if not nrd_name .name :
1067
1067
deleted_names [nrd_name .choice - 1 ] = True
@@ -1074,17 +1074,17 @@ def put(nr, *args, **kwargs):
1074
1074
# we only add new comments, we do not change existing comments
1075
1075
# - we can find new comments in json as those with no ID
1076
1076
# - This must come after names section above, to handle comments re. changed names.
1077
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1077
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1078
1078
for in_comment in json_input ['comments' ]:
1079
1079
is_new_comment = False
1080
1080
try :
1081
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1081
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1082
1082
if in_comment ['id' ] is None or in_comment ['id' ] == 0 :
1083
1083
is_new_comment = True
1084
1084
except KeyError :
1085
1085
is_new_comment = True
1086
1086
if is_new_comment and in_comment ['comment' ] is not None :
1087
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1087
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1088
1088
new_comment = Comment ()
1089
1089
new_comment .comment = convert_to_ascii (in_comment ['comment' ])
1090
1090
new_comment .examiner = user
@@ -1096,17 +1096,17 @@ def put(nr, *args, **kwargs):
1096
1096
1097
1097
is_changed__nwpta_ab = False
1098
1098
is_changed__nwpta_sk = False
1099
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1099
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1100
1100
if nrd .partnerNS .count () > 0 :
1101
1101
for nrd_nwpta in nrd .partnerNS .all ():
1102
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1102
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1103
1103
1104
1104
orig_nwpta = nrd_nwpta .as_dict ()
1105
1105
1106
1106
for in_nwpta in json_input ['nwpta' ]:
1107
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1107
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1108
1108
if nrd_nwpta .partnerJurisdictionTypeCd == in_nwpta ['partnerJurisdictionTypeCd' ]:
1109
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1109
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1110
1110
errors = nwpta_schema .validate (in_nwpta , partial = False )
1111
1111
if errors :
1112
1112
MessageServices .add_message (MessageServices .ERROR , 'nwpta_validation' , errors )
@@ -1138,21 +1138,21 @@ def put(nr, *args, **kwargs):
1138
1138
1139
1139
# if there were errors, abandon changes and return the set of errors
1140
1140
warning_and_errors = MessageServices .get_all_messages ()
1141
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1141
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1142
1142
if warning_and_errors :
1143
1143
for we in warning_and_errors :
1144
1144
if we ['type' ] == MessageServices .ERROR :
1145
1145
return make_response (jsonify (errors = warning_and_errors ), 400 )
1146
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1146
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1147
1147
if reset :
1148
1148
nrd .expirationDate = None
1149
1149
nrd .consentFlag = None
1150
1150
nrd .consent_dt = None
1151
1151
is_changed__request = True
1152
1152
is_changed_consent = True
1153
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1153
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1154
1154
else :
1155
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1155
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1156
1156
change_flags = {
1157
1157
'is_changed__request' : is_changed__request ,
1158
1158
'is_changed__previous_request' : is_changed__previous_request ,
@@ -1168,33 +1168,33 @@ def put(nr, *args, **kwargs):
1168
1168
}
1169
1169
1170
1170
if any (value is True for value in change_flags .values ()):
1171
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1171
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1172
1172
nrd .save_to_db ()
1173
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1173
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1174
1174
1175
1175
# Delete any names that were blanked out
1176
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1176
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1177
1177
for nrd_name in nrd .names :
1178
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1178
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1179
1179
if deleted_names [nrd_name .choice - 1 ]:
1180
1180
nrd_name .delete_from_db ()
1181
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1181
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1182
1182
1183
1183
# if there were errors, return the set of errors
1184
1184
warning_and_errors = MessageServices .get_all_messages ()
1185
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1185
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1186
1186
if warning_and_errors :
1187
1187
for we in warning_and_errors :
1188
1188
if we ['type' ] == MessageServices .ERROR :
1189
1189
return make_response (jsonify (errors = warning_and_errors ), 400 )
1190
1190
1191
1191
# Finally save the entire graph
1192
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1192
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1193
1193
nrd .save_to_db ()
1194
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1194
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1195
1195
1196
1196
EventRecorder .record (user , Event .PUT , nrd , json_input )
1197
- current_app .logger .debug (f" continue...stateCd: { 0 } " .format (nrd .stateCd ))
1197
+ current_app .logger .debug (' continue...stateCd: {}' .format (nrd .stateCd ))
1198
1198
1199
1199
except ValidationError as ve :
1200
1200
return make_response (jsonify (ve .messages ), 400 )
0 commit comments