Skip to content

Commit

Permalink
Fix Py 2/3 unicode conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
loleg committed Dec 6, 2023
1 parent bb850c0 commit 0aae0e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckanext/dcatapchharvest/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,18 @@ def _get_groups(self, subject):
for dcat_theme_url in dcat_theme_urls:
eu_theme_url = None

# Python 2 / 3 compatibility
import sys
if sys.version_info[0] >= 3:
unicode = str

# Case 1: We get a deprecated opendata.swiss theme. Replace
# the base url with the dcat-ap.ch base url, so we can
# look it up in the theme mapping.
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])

Expand Down

0 comments on commit 0aae0e6

Please sign in to comment.