コード例 #1
0
 def __init__(self, first_name=None, last_name=None, mail=None,
              username=None, id_number=None, error_messages=None):
     ErrorMessageList.__init__(self, error_messages=error_messages)
     self.first_name = first_name
     self.last_name = last_name
     self.mail = mail
     self.username = username
     self.id_number = id_number
    def validate_response(self, response):
        response_json = json.loads(response)
        token = response_json['data']['token']
        error_messages_list = ErrorMessageList()
        for error in response_json['data']['error_messages']:
            error_messages_list.add_error_message(
                message=error['message'],
                message_connection=error['message_connection']
            )

        if token is not None:
            self.registrationScreen.parent.token = token
            self.registrationScreen.parent.transition.direction = 'down'
            self.registrationScreen.parent.current = HOME_SCREEN
        else:
            error_messages = error_messages_list.get_error_messages()[0]
            self.registrationViewModel.get_error_message().text = "{0}: {1}".format(
                error_messages.get_type(), error_messages.get_message())
    def mock_data_error(self):
        messages = ErrorMessageList()

        messages.add_error_message(
            message='Invalid credentials',
            message_connection='Login'
        )

        messages.add_error_message(
            message='Invalid credentials',
            message_connection='Login'
        )

        return self.registrationDto.PostResponse(
            token=None,
            error_messages=messages.get_error_messages()
        ).toJSON()
コード例 #4
0
 def __init__(self, error_messages=None):
     ErrorMessageList.__init__(self, error_messages=error_messages)
 def __init__(self, error_messages=None, result_list=None):
     ErrorMessageList.__init__(self, error_messages=error_messages)
     if result_list is None:
         result_list = []
     self.result_list = result_list