def get_data(self): try: data_sources = saharaclient.data_source_list(self.request) except Exception: data_sources = [] exceptions.handle(self.request, _("Unable to fetch data sources.")) return data_sources
def get_data_source_choices(self, request, context): try: data_sources = saharaclient.data_source_list(request) except Exception: data_sources = [] exceptions.handle(request, _("Unable to fetch data sources.")) choices = [(data_source.id, data_source.name) for data_source in data_sources] choices.insert(0, (None, 'None')) return choices