Skip to content

Commit

Permalink
Wrap tag munging code in config option, defaulting to False.
Browse files Browse the repository at this point in the history
  • Loading branch information
bellisk committed Jan 29, 2014
1 parent 2b803a3 commit 7d71b0a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ckanext/harvest/harvesters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@
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):
Expand Down

0 comments on commit 7d71b0a

Please sign in to comment.