From 4fbaec09861adc4c8b1f5655c9aa7773899aaa34 Mon Sep 17 00:00:00 2001 From: David Read Date: Wed, 25 Nov 2015 20:58:50 +0000 Subject: [PATCH] Improve harvester type error message. Add docstring. --- ckanext/harvest/logic/validators.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ckanext/harvest/logic/validators.py b/ckanext/harvest/logic/validators.py index d12be67..e41c91c 100644 --- a/ckanext/harvest/logic/validators.py +++ b/ckanext/harvest/logic/validators.py @@ -34,6 +34,9 @@ def harvest_job_exists(value, context): def _normalize_url(url): + '''Strips off parameters off a URL, and an unnecessary port number, so that + simple variations on a URL are ignored, to used to help avoid getting two + harvesters for the same URL.''' o = urlparse.urlparse(url) # Normalize port @@ -118,8 +121,8 @@ def harvest_source_type_exists(value, context): available_types.append(info['name']) if not value in available_types: - raise Invalid('Unknown harvester type: %s. Have you registered a ' - 'harvester for this type?' % value) + raise Invalid('Unknown harvester type: %s. Registered types: %r' % + (value, available_types)) return value