def get_data(self): filters = self.get_filters() prev_marker = self.request.GET.get( ReceiversTable._meta.prev_pagination_param, None) if prev_marker is not None: marker = prev_marker else: marker = self.request.GET.get( ReceiversTable._meta.pagination_param, None) reversed_order = prev_marker is not None try: receivers, self._more, self._prev = senlin.receiver_list( self.request, marker=marker, paginate=True, reversed_order=reversed_order, filters=filters) except Exception: self._prev = self._more = False receivers = [] msg = _('Unable to retrieve receivers.') exceptions.handle(self.request, msg) return receivers
def get_data(self): try: params = {} receivers = senlin.receiver_list(self.request, params) except Exception: receivers = [] exceptions.handle(self.request, _('Unable to retrieve receivers.')) return receivers
def get(self, request): """Get a list of receivers.""" filters, kwargs = rest_utils.parse_filters_kwargs(request, CLIENT_KEYWORDS) receivers, has_more_data, has_prev_data = senlin.receiver_list( request, filters=filters, **kwargs) return { 'items': [r.to_dict() for r in receivers], 'has_more_data': has_more_data, 'has_prev_data': has_prev_data, }
def get(self, request): """Get a list of receivers.""" filters, kwargs = rest_utils.parse_filters_kwargs( request, CLIENT_KEYWORDS) receivers, has_more_data, has_prev_data = senlin.receiver_list( request, filters=filters, **kwargs) receivers_dict = [] for r in receivers: r = r.to_dict() r["params"] = api_utils.convert_to_yaml(r["params"]) r["channel"] = api_utils.convert_to_yaml(r["channel"]) receivers_dict.append(r) return { 'items': receivers_dict, 'has_more_data': has_more_data, 'has_prev_data': has_prev_data, }