Skip to content
Snippets Groups Projects
Commit 37394c51 authored by anonymous's avatar anonymous
Browse files

merge

parents 43f323b9 a5021404
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ import csv ...@@ -16,6 +16,7 @@ import csv
import urllib2 import urllib2
from ckan.common import request from ckan.common import request
import pdb import pdb
from urlparse import urlsplit, urlunsplit
get_action = logic.get_action get_action = logic.get_action
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -235,3 +236,11 @@ def spatial_extends_available(): ...@@ -235,3 +236,11 @@ def spatial_extends_available():
spatial_text = row[1] spatial_text = row[1]
result.append(spatial_text.decode('UTF-8')) result.append(spatial_text.decode('UTF-8'))
return result return result
def odsh_public_resource_url(res):
home = config.get('ckanext.odsh.public_url')
if res.get('url_type',None) == 'upload' and 'url' in res:
f = urlsplit(res['url'])
return urlunsplit((0, 0, f[2], f[3], f[4]))
else:
return res['url']
...@@ -7,12 +7,20 @@ from ckan.lib.search.common import ( ...@@ -7,12 +7,20 @@ from ckan.lib.search.common import (
make_connection, SearchError, SearchQueryError make_connection, SearchError, SearchQueryError
) )
import pysolr import pysolr
import datetime
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def odsh_package_create(context, data_dict): def odsh_package_create(context, data_dict):
munge_increment_name(data_dict) munge_increment_name(data_dict)
issued = False
for extra in data_dict.get('extras'):
if extra['key'] == 'issued':
issued = True
break
if not issued:
data_dict['extras'].append({'key': 'issued', 'value': datetime.datetime.utcnow().isoformat()})
return package_create(context, data_dict) return package_create(context, data_dict)
......
...@@ -290,7 +290,11 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ...@@ -290,7 +290,11 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
'odsh_tracking_url': odsh_helpers.odsh_tracking_url, 'odsh_tracking_url': odsh_helpers.odsh_tracking_url,
'odsh_has_more_facets': odsh_helpers.odsh_has_more_facets, 'odsh_has_more_facets': odsh_helpers.odsh_has_more_facets,
'odsh_public_url': odsh_helpers.odsh_public_url, 'odsh_public_url': odsh_helpers.odsh_public_url,
<<<<<<< HEAD
'odsh_spatial_extends_available': odsh_helpers.spatial_extends_available 'odsh_spatial_extends_available': odsh_helpers.spatial_extends_available
=======
'odsh_public_resource_url': odsh_helpers.odsh_public_resource_url
>>>>>>> sprint11
} }
def after_map(self, map): def after_map(self, map):
......
{% set url_action = 'resource_edit' if url_is_edit and can_edit else 'resource_read' %} {% set url_action = 'resource_edit' if url_is_edit and can_edit else 'resource_read' %}
{% set url = h.url_for(controller='package', action=url_action, id=pkg.name, resource_id=res.id) %} {% set url = h.url_for(controller='package', action=url_action, id=pkg.name, resource_id=res.id) %}
{% set download = res.url or url %} {# hack for correcting slave url if resource was uploaded #}
{% set res_details = h.odsh_get_resource_details(res.id) %} {% set download = h.odsh_public_resource_url(res) or ulr%}
<li class="resource-item" data-id="{{ res.id }}"> <li class="resource-item" data-id="{{ res.id }}">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment