tag_munge from ckan 2.2 fails the test with dashes, so use the harvest one for this ckan version.

This commit is contained in:
David Read 2015-11-23 17:31:20 +00:00
parent 52f7e0dd07
commit bc26159fb6
1 changed files with 4 additions and 4 deletions

View File

@ -21,14 +21,14 @@ from ckanext.harvest.model import HarvestJob, HarvestObject, HarvestGatherError,
from ckan.plugins.core import SingletonPlugin, implements
from ckanext.harvest.interfaces import IHarvester
try:
if p.toolkit.check_ckan_version(min_verion='2.3'):
from ckan.lib.munge import munge_tag
except ImportError:
# Fallback for older ckan versions which don't have it
else:
# Fallback for older ckan versions which don't have a decent munger
def munge_tag(tag):
tag = substitute_ascii_equivalents(tag)
tag = tag.lower().strip()
return re.sub(r'[^a-zA-Z0-9 -]', '', tag).replace(' ', '-')
return re.sub(r'[^a-zA-Z0-9\- ]', '', tag).replace(' ', '-')
log = logging.getLogger(__name__)