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:
parent
52f7e0dd07
commit
bc26159fb6
|
@ -21,14 +21,14 @@ 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
|
||||||
|
|
||||||
try:
|
if p.toolkit.check_ckan_version(min_verion='2.3'):
|
||||||
from ckan.lib.munge import munge_tag
|
from ckan.lib.munge import munge_tag
|
||||||
except ImportError:
|
else:
|
||||||
# Fallback for older ckan versions which don't have it
|
# Fallback for older ckan versions which don't have a decent munger
|
||||||
def munge_tag(tag):
|
def munge_tag(tag):
|
||||||
tag = substitute_ascii_equivalents(tag)
|
tag = substitute_ascii_equivalents(tag)
|
||||||
tag = tag.lower().strip()
|
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__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue