def _build_response_data(self, request): # pylint: disable=unused-argument,no-self-use """build response data""" msg = 'New password has been saved.' data = { 'header': response_header(msg, request.user.username), 'detail': {} } return data
def response_data(self, data, username): # pylint: disable=no-self-use """build response data""" msg = 'Hierarchy request successfully processed.' data = { 'header': response_header(msg=msg, username=username, api_status=constants.STATUS_OK), 'detail': data } return data
def _build_response_data(self, request, username): # pylint: disable=unused-argument,no-self-use """build response data""" if username != constants.UNKNOWN_USER: api_status = constants.STATUS_OK msg = 'Successfully logged out.' else: api_status = constants.STATUS_ERROR msg = 'Failed to log out.' header = response_header(msg=msg, username=username, api_status=api_status) data = {'header': header, 'detail': {}} return data
def _build_response_data(self, token): # pylint: disable=unused-argument """build response data""" header = response_header(msg='Successfully logged in.', username=self.user.username) data = { 'header': header, 'detail': { 'email': self.user.email, 'token': token, 'first_name': self.user.first_name, 'last_name': self.user.last_name } } return data
def _build_response_data(self, results, saved_results, msg=None, api_status=None): # pylint: disable=unused-argument """build response data""" msg = msg or 'Analysis request successfully processed.' api_status = api_status or constants.STATUS_OK header = response_header(msg=msg, username=self.request.user.username, api_status=api_status) results[ 'analysis_results_id'] = saved_results.id if saved_results else None data = {'header': header, 'detail': results} return data