Wrap tag munging code in config option, defaulting to False.
This commit is contained in:
parent
2b803a3f66
commit
7d71b0a00b
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue