From 3af18cd38e1cf9577d38888a9e44619b2cc02295 Mon Sep 17 00:00:00 2001 From: steckerhalter Date: Thu, 24 Oct 2013 18:00:23 +0200 Subject: [PATCH 1/2] added org description --- ckanext/fso/harvesters/fsoharvester.py | 30 ++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/ckanext/fso/harvesters/fsoharvester.py b/ckanext/fso/harvesters/fsoharvester.py index b2cff35..383987e 100644 --- a/ckanext/fso/harvesters/fsoharvester.py +++ b/ckanext/fso/harvesters/fsoharvester.py @@ -27,10 +27,20 @@ class FSOHarvester(OGDCHHarvesterBase): FILES_BASE_URL = "http://www.bfs.admin.ch/xmlns/opendata/" HARVEST_USER = u'harvest' ORGANIZATION = { - 'de': u'Bundesamt für Statistik', - 'fr': u'Office fédéral de la statistique', - 'it': u'Ufficio federale di statistica', - 'en': u'Swiss Federal Statistical Office', + 'de': { + 'name': u'Bundesamt für Statistik', + 'description': u'Orientiert über den Stand und die Entwicklung der Schweiz in zahlreichen Lebensbereichen. Es liefert die quantitativen Informationen, um die Gegenwart zu verstehen und die Zukunft zu planen.', + 'website': u'http://www.bfs.admin.ch/' + }, + 'fr': { + 'name': u'Office fédéral de la statistique', + 'description': u'Fournit des informations sur l’état et l’évolution de la Suisse dans de nombreux domaines. Les informations qu’il produit servent à comprendre le présent et à planifier l’avenir.'}, + 'it': { + 'name': u'Ufficio federale di statistica', + 'description': u'Fornisce informazioni sullo stato e sull’evoluzione della Svizzera nei più svariati settori che permettono di capire il presente e pianificare il futuro.'}, + 'en': { + 'name': u'Swiss Federal Statistical Office', + 'description': u'Publishes information on the situation and trends in Switzerland in many different areas of life. It provides the quantitative information needed to understand the present and to plan for the future.'} } GROUPS = { 'de': [u'Bevölkerung', u'Politik'], @@ -104,7 +114,7 @@ def _gen_new_name(self, title, current_id=None): if pkg_obj and pkg_obj.id != current_id: return name + str(uuid4())[:5] else: - return name + return name def _file_is_available(self, url): @@ -337,9 +347,11 @@ def import_stage(self, harvest_object): try: data_dict = { 'permission': 'edit_group', - 'id': munge_title_to_name(self.ORGANIZATION['de']), - 'name': munge_title_to_name(self.ORGANIZATION['de']), - 'title': self.ORGANIZATION['de'] + 'id': munge_title_to_name(self.ORGANIZATION['de']['name']), + 'name': munge_title_to_name(self.ORGANIZATION['de']['name']), + 'title': self.ORGANIZATION['de']['name'], + 'description': self.ORGANIZATION['de']['description'], + 'extras': [('website', self.ORGANIZATION['de']['website'])] } package_dict['owner_org'] = get_action('organization_show')(context, data_dict)['id'] except: @@ -352,7 +364,7 @@ def import_stage(self, harvest_object): if 'license_url' in package_dict: extras.append(('license_url', package_dict['license_url'])) package_dict['extras'] = extras - log.debug('Extras %s' % extras) + log.debug('Extras %s' % extras) package = model.Package.get(package_dict['id']) pkg_role = model.PackageRole(package=package, user=user, role=model.Role.ADMIN) From 2e2b619bb12bdbeb3900c60329e86e124031c3b7 Mon Sep 17 00:00:00 2001 From: Stefan Oderbolz Date: Fri, 25 Oct 2013 01:37:15 +0200 Subject: [PATCH 2/2] OGDCH-166: Fix format of extra field --- ckanext/fso/harvesters/fsoharvester.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ckanext/fso/harvesters/fsoharvester.py b/ckanext/fso/harvesters/fsoharvester.py index 383987e..637f117 100644 --- a/ckanext/fso/harvesters/fsoharvester.py +++ b/ckanext/fso/harvesters/fsoharvester.py @@ -351,7 +351,12 @@ def import_stage(self, harvest_object): 'name': munge_title_to_name(self.ORGANIZATION['de']['name']), 'title': self.ORGANIZATION['de']['name'], 'description': self.ORGANIZATION['de']['description'], - 'extras': [('website', self.ORGANIZATION['de']['website'])] + 'extras': [ + { + 'key': 'website', + 'value': self.ORGANIZATION['de']['website'] + } + ] } package_dict['owner_org'] = get_action('organization_show')(context, data_dict)['id'] except: