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

Wip

parent 47d5c9a9
Branches
Tags
2 merge requests!41Version 2.0.0,!38Merge py3 into dev
...@@ -143,16 +143,12 @@ def _get_language_id(pkg_dict): ...@@ -143,16 +143,12 @@ def _get_language_id(pkg_dict):
def get_spatial_for_selection(): def get_spatial_for_selection():
mapping_path = config.get('ckanext.odsh.spatial.mapping') mapping_path = config.get('ckanext.odsh.spatial.mapping')
try: with open(mapping_path, newline='') as mapping_file:
mapping_file = urllib.request.urlopen(mapping_path)
except urllib.error.URLError:
log.error('Could not load spatial mapping file')
raise
cr = csv.reader(mapping_file, delimiter="\t") cr = csv.reader(mapping_file, delimiter="\t")
spatial_mapping = list() spatial_mapping = list()
for row in cr: for row in cr:
key = row[0].decode('UTF-8') key = row[0]
value = row[1].decode('UTF-8') value = row[1]
spatial_mapping.append({'key':key, 'value':value}) spatial_mapping.append({'key':key, 'value':value})
spatial_mapping.append({'key':'', 'value':''}) spatial_mapping.append({'key':'', 'value':''})
return spatial_mapping return spatial_mapping
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<a href="/harvest">Harvester</a> <a href="/harvest">Harvester</a>
</li> </li>
<li class='{{clazz}}'> <li class='{{clazz}}'>
{% link_for _('Upload'), controller='dataset', action='new', group=c.group_dict.id, class_='text' %} {% link_for _('Upload'), controller='dataset', action='new', class_='text' %}
</li> </li>
{% endif %} {% endif %}
{% if c.userobj %} {% if c.userobj %}
......
...@@ -10,7 +10,6 @@ Example: ...@@ -10,7 +10,6 @@ Example:
#} #}
{% set daterange = h.tpsh_get_daterange_prettified(pkg) %} {% set daterange = h.tpsh_get_daterange_prettified(pkg) %}
{% set language_icon = h.get_language_icon(pkg) %}
{% set license_attribution_by_text = h.odsh_extract_value_from_extras(pkg.extras, 'licenseAttributionByText') %} {% set license_attribution_by_text = h.odsh_extract_value_from_extras(pkg.extras, 'licenseAttributionByText') %}
{% block package_info %} {% block package_info %}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% set data = data or {} %} {% set data = data or {} %}
{% set errors = errors or {} %} {% set errors = errors or {} %}
{% set active = data and data.state=='active' %} {% set active = data and data.state=='active' %}
{% set action = form_action or h.url_for(controller='dataset', action='new_resource', id=pkg_name) %} {% set action = form_action or h.url_for(controller='resource', action='new', id=pkg_name) %}
<form id="resource-edit" class="dataset-form dataset-resource-form {%if(data)%}resource-edit-form{%endif%}" method="post" action="{{ action }}" data-module="basic-form resource-form" <form id="resource-edit" class="dataset-form dataset-resource-form {%if(data)%}resource-edit-form{%endif%}" method="post" action="{{ action }}" data-module="basic-form resource-form"
enctype="multipart/form-data" novalidate> enctype="multipart/form-data" novalidate>
......
...@@ -12,6 +12,7 @@ import ckan.model as model ...@@ -12,6 +12,7 @@ import ckan.model as model
from ckan.lib.navl.dictization_functions import Missing from ckan.lib.navl.dictization_functions import Missing
from ckanext.odsh.helpers_tpsh import get_package_dict from ckanext.odsh.helpers_tpsh import get_package_dict
import ckan.plugins.toolkit as tk
_ = toolkit._ _ = toolkit._
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment