Skip to content
Snippets Groups Projects
Commit 55a421e2 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Use csv instead of unicodecsv

parent a08baf51
No related branches found
No related tags found
2 merge requests!41Version 2.0.0,!38Merge py3 into dev
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import logging import logging
import unicodecsv as csv import csv
import re import re
import urllib.request, urllib.error, urllib.parse import urllib.request, urllib.error, urllib.parse
import json import json
...@@ -214,16 +214,13 @@ def known_spatial_uri(key, data, errors, context): ...@@ -214,16 +214,13 @@ def known_spatial_uri(key, data, errors, context):
data[('extras', new_index+1, 'value')] = poly data[('extras', new_index+1, 'value')] = poly
return return
mapping_file = tk.config.get('ckanext.odsh.spatial.mapping') mapping_path = tk.config.get('ckanext.odsh.spatial.mapping')
try:
mapping_file = urllib.request.urlopen(mapping_file)
except Exception:
raise Exception("Could not load spatial mapping file!")
not_found = True not_found = True
spatial_text = str() spatial_text = str()
spatial = str() spatial = str()
cr = csv.reader(mapping_file, delimiter="\t", encoding='utf-8') with open(mapping_path, newline='') as mapping_file:
cr = csv.reader(mapping_file, delimiter="\t")
for row in cr: for row in cr:
if row[0] == value: if row[0] == value:
not_found = False not_found = False
......
...@@ -165,7 +165,6 @@ traceback2==1.4.0 ...@@ -165,7 +165,6 @@ traceback2==1.4.0
translationstring==1.3 translationstring==1.3
typing==3.6.4 typing==3.6.4
tzlocal==1.3 tzlocal==1.3
unicodecsv==0.14.1
unittest2==1.1.0 unittest2==1.1.0
urllib3==1.23 urllib3==1.23
vdm==0.13 vdm==0.13
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment