def generate_template_data(self, org_info): errors = [] org_id = org_info['name'] top_line_num_resource = org_info.get('topline_resource', None) top_line_items = [] if top_line_num_resource: try: top_line_items = self.get_top_line_numbers(top_line_num_resource) except Exception, e: log.warning(e) hdx_helpers.add_error('Fetching data problem', str(e), errors)
def generate_template_data(self, id, group_info, custom_dict): ''' Compute all data for current custom location/crisis :param group_info: information about group (location) :param custom_dict: information about map :return: return the template (dictionary) containing data ''' errors = [] country_name = group_info['name'] or id top_line_items = [] try: top_line_resource_id = self._get_top_line_datastore_id(custom_dict) top_line_items = location_data_access.get_formatted_topline_numbers(top_line_resource_id) except Exception, e: log.warning(e) helpers.add_error('Fetching data problem', str(e), errors)
activities = None # facets = {} # query_placeholder = '' try: c.full_facet_info = self.get_dataset_search_results(org_id) c.tab = tab = self.get_tab_name() # query_placeholder = self.generate_query_placeholder(tab, c.dataset_counts, c.indicator_counts) # facets = self.get_facet_information( # tab_results, all_results, tab, req_params) if tab == 'activities': activities = self.get_activity_stream( org_info.get('id', org_id)) except Exception, e: log.warning(e) hdx_helpers.add_error('Fetching data problem', str(e), errors) if 'parameter must be an integer' in e.message: abort(404, 'Page not found') if 'Parameter' in e.message and 'is not an integer' in e.message: abort(404, 'Page not found') allow_basic_user_info = self.check_access('hdx_basic_user_info') allow_req_membership = not h.user_in_org_or_group( org_info['id']) and allow_basic_user_info allow_edit = self.check_access('organization_update', {'id': org_info['id']}) allow_add_dataset = self.check_access('package_create', { 'organization_id': org_info['id'], 'owner_org': org_info['id'] })