Skip to content

Commit

Permalink
remove python2 legacy tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ltclm committed Jun 21, 2023
1 parent 7f86edb commit 081ce60
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
12 changes: 1 addition & 11 deletions chsdi/templates/htmlpopup/kgs.mako
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,7 @@
dataGeoAdminHost = request.registry.settings['datageoadminhost']
csv_url = dataGeoAdminHost + "/" + c['layerBodId'] + "/image/meta.txt"
csv_file = None
# TODO python2 clean-up
try:
from urllib2 import urlopen
csv_file = urlopen(csv_url)
reader = csv.reader(csv_file, delimiter =';') # creates the reader object
next(reader) # Skip header
pic_list = [map(lambda x: x.decode("utf-8"), row) for row in reader if int(row[0]) == c['featureId']]
csv_file.close()
except ImportError:
# Python3 fallback
from urllib.request import urlopen
from urllib.request import urlopen
csv_file = urlopen(csv_url).read().decode('utf-8')
reader = csv.reader(csv_file.splitlines(), delimiter =';') # creates the reader object
next(reader) # Skip header
Expand Down
6 changes: 1 addition & 5 deletions chsdi/templates/htmlpopup/lubis.mako
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import datetime
from pyramid.url import route_url
import chsdi.lib.helpers as h
import markupsafe
# TODO python2 clean-up
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from urllib.parse import urlencode
def br(text):
return text.replace('\n', markupsafe.Markup('<br />'))
Expand Down
6 changes: 1 addition & 5 deletions chsdi/templates/htmlpopup/lubis_stac.mako
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import chsdi.lib.helpers as h
import markupsafe
logger = logging.getLogger(__name__)
# TODO python2 clean-up
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from urllib.parse import urlencode
def br(text):
return text.replace('\n', markupsafe.Markup('<br />'))
Expand Down

0 comments on commit 081ce60

Please sign in to comment.