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 ckan.plugins.core import SingletonPlugin, implements
|
||||||
from ckanext.harvest.interfaces import IHarvester
|
from ckanext.harvest.interfaces import IHarvester
|
||||||
|
|
||||||
|
from pylons import config
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def munge_tag(tag):
|
def munge_tag(tag):
|
||||||
tag = substitute_ascii_equivalents(tag)
|
clean_tags = config.get('ckanext.harvest.ckanharvester.clean_tags')
|
||||||
tag = tag.lower().strip()
|
if clean_tags:
|
||||||
return re.sub(r'[^a-zA-Z0-9 -]', '', tag).replace(' ', '-')
|
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):
|
class HarvesterBase(SingletonPlugin):
|
||||||
|
|
Loading…
Reference in New Issue