From 7d71b0a00b8742bc79d6d227016beaf0849b886e Mon Sep 17 00:00:00 2001 From: Rachel Knowler Date: Wed, 29 Jan 2014 10:02:16 +0100 Subject: [PATCH] Wrap tag munging code in config option, defaulting to False. --- ckanext/harvest/harvesters/base.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ckanext/harvest/harvesters/base.py b/ckanext/harvest/harvesters/base.py index c2855e4..ad3a629 100644 --- a/ckanext/harvest/harvesters/base.py +++ b/ckanext/harvest/harvesters/base.py @@ -20,13 +20,20 @@ from ckanext.harvest.model import HarvestJob, HarvestObject, HarvestGatherError, from ckan.plugins.core import SingletonPlugin, implements from ckanext.harvest.interfaces import IHarvester +from pylons import config + log = logging.getLogger(__name__) def munge_tag(tag): - tag = substitute_ascii_equivalents(tag) - tag = tag.lower().strip() - return re.sub(r'[^a-zA-Z0-9 -]', '', tag).replace(' ', '-') + clean_tags = config.get('ckanext.harvest.ckanharvester.clean_tags') + if clean_tags: + tag = substitute_ascii_equivalents(tag) + tag = tag.lower().strip() + return re.sub(r'[^a-zA-Z0-9 -]', '', tag).replace(' ', '-') + else: + return tag + class HarvesterBase(SingletonPlugin):