Skip to content

Commit

Permalink
Merge pull request #99 from opendata-swiss/fix/use_get_method_theme_m…
Browse files Browse the repository at this point in the history
…apping

Use get method to handle the unknown urls
  • Loading branch information
kovalch authored Mar 1, 2024
2 parents 719b2bb + 52d4adc commit 824c4e7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ckanext/dcatapchharvest/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,15 @@ def _get_groups(self, subject):
if dcat_theme_url.startswith(OGD_THEMES_URI):
new_theme_url = dcat_theme_url.replace(
OGD_THEMES_URI, CHTHEMES_URI)
eu_theme_url = unicode(
eu_theme_mapping[URIRef(new_theme_url)][0])
eu_theme_url = eu_theme_mapping.get(
URIRef(new_theme_url), [None])[0]

# Case 2: We get a dcat-ap.ch theme (the same as the
# opendata.swiss themes, but different base url). Get
# the correct EU theme from the theme mapping.
elif dcat_theme_url.startswith(CHTHEMES_URI):
eu_theme_url = unicode(
eu_theme_mapping[URIRef(dcat_theme_url)][0])
eu_theme_url = eu_theme_mapping.get(
URIRef(dcat_theme_url), [None])[0]

# Case 3: We get an EU theme and don't need to look it up in
# the mapping.
Expand Down

0 comments on commit 824c4e7

Please sign in to comment.