Merged master

This commit is contained in:
John Martin 2013-08-15 18:47:16 +01:00
commit 86dcd933ea
5 changed files with 15 additions and 5 deletions

View File

@ -147,6 +147,7 @@ class HarvesterBase(SingletonPlugin):
'user': user_name,
'api_version': api_version,
'schema': schema,
'ignore_auth': True,
}
tags = package_dict.get('tags', [])

View File

@ -51,7 +51,8 @@ class CKANHarvester(HarvesterBase):
def _set_config(self,config_str):
if config_str:
self.config = json.loads(config_str)
self.api_version = int(self.config['api_version'])
if 'api_version' in self.config:
self.api_version = int(self.config['api_version'])
log.debug('Using config: %r', self.config)
else:
@ -244,6 +245,10 @@ class CKANHarvester(HarvesterBase):
try:
package_dict = json.loads(harvest_object.content)
if package_dict.get('type') == 'harvest':
log.warn('Remote dataset is a harvest source, ignoring...')
return False
# Set default tags if needed
default_tags = self.config.get('default_tags',[])
if default_tags:

View File

@ -38,7 +38,9 @@ Example:
{% endif %}
<p class="muted">
{{ _('Datasets') }}: {{ source.status.total_datasets }}
{% if source.status %}
{{ _('Datasets') }}: {{ source.status.total_datasets }}
{% endif %}
{% if not within_organization and source.organization %}
&mdash; {{ _('Organization') }}: {{ h.link_to(source.organization.title or source.organization.name, h.url_for('organization_read', id=source.organization.name)) }}</a>
{% endif %}

View File

@ -3,7 +3,7 @@
{% block primary_content_inner %}
<section class="module-content">
<h1>Last Harvest Job</h1>
{% if source.status.last_job %}
{% if source.status and source.status.last_job %}
{% snippet "snippets/job_details.html", job=source.status.last_job %}
<div class="form-actions">
<a href="{{ h.url_for(controller='ckanext.harvest.controllers.view:ViewController', action='show_last_job', source=source.name) }}" class="btn pull-right">

View File

@ -26,8 +26,10 @@
{% endif %}
<div class="nums">
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ c.harvest_source.status.total_datasets }}</dd>
{% if c.harvest_source.status %}
<dt>{{ _('Datasets') }}</dt>
<dd>{{ c.harvest_source.status.total_datasets }}</dd>
{% endif %}
</dl>
</div>
</section>