def invalid_answer_for_uid_registration_handler(dbm, invalid_answers): return get_account_wide_sms_reply( dbm, "reply_incorrect_answers", placeholder_dict={ 'Question Numbers for Wrong Answer(s)': invalid_answers })
def identification_number_already_exists_handler(dbm, submitted_id, identification_number_type): return get_account_wide_sms_reply( dbm, "reply_identification_number_already_exists", placeholder_dict={ 'Submitted Identification Number': submitted_id, 'Identification Number Type': identification_number_type })
def success_subject_registration_handler(dbm, datasender_name, list_of_answers): message = get_account_wide_sms_reply( dbm, message_code='reply_success_identification_number_registration', placeholder_dict={ 'Name of Data Sender': datasender_name, 'Identification Number Type': list_of_answers[0], 'Name of Identification Number': list_of_answers[1], 'Submitted Identification Number': list_of_answers[2] }) return message
def incorrect_questionnaire_code_handler(dbm, invalid_form_code, request): exception = request.get('exception') if exception: handler = exception_handlers.get(type(exception), default_exception_handler) return handler(exception, request) message = get_account_wide_sms_reply( dbm, "reply_incorrect_questionnaire_code", placeholder_dict={'Submitted Questionnaire Code': invalid_form_code}) create_failure_log(message, request) return message
def sms_parser_invalid_format_handler(exception, request): #if len(request.get('incoming_message').strip().split()) != 1: # return default_exception_handler_with_logger(exception, request) try: form_code = exception.data[0][0] form_model = get_form_model_by_code(request.get('dbm'), form_code) message_code = 'reply_incorrect_number_of_responses' message = get_customized_message_for_questionnaire( request['dbm'], request, message_code=message_code, form_code=form_code, form_model=form_model) request['form_code'] = form_code except: message_code = 'reply_incorrect_questionnaire_code' message = get_account_wide_sms_reply( request.get('dbm'), message_code, placeholder_dict={'Submitted Questionnaire Code': form_code}) create_failure_log(message, request) return message
def incorrect_questionnaire_code_handler(dbm, invalid_form_code): return get_account_wide_sms_reply( dbm, "reply_incorrect_questionnaire_code", placeholder_dict={'Submitted Questionnaire Code': invalid_form_code})
def incorrect_number_of_answers_for_uid_registration_handler( dbm, form_code, request): return get_account_wide_sms_reply(dbm, "reply_incorrect_number_of_responses", placeholder_dict={})
def data_sender_not_registered_handler(dbm): message = get_account_wide_sms_reply( dbm, message_code='reply_ds_not_registered') return message
def data_sender_not_registered_handler(exception, request): message = get_account_wide_sms_reply( request['dbm'], message_code='reply_ds_not_registered') create_failure_log(message, request) return message