diff -r 33fd91a414cc -r a7f4a418d5af src/core/wp_utils.py --- a/src/core/wp_utils.py Wed Jul 10 17:34:14 2013 +0200 +++ b/src/core/wp_utils.py Wed Jul 10 18:47:44 2013 +0200 @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- from .models import Term, TermLabel, TERM_URL_STATUS_DICT +from core.models.term import TERM_WK_LINK_SEMANTIC_LEVEL_DICT from django.conf import settings from django.utils.http import urlquote +from urlparse import urlparse from wikitools import api, wiki import logging -from core.models.term import TERM_WK_LINK_SEMANTIC_LEVEL_DICT +import urllib2 logger = logging.getLogger(__name__) site = None @@ -172,6 +174,10 @@ if not label: label = term.label + elif label.startswith(settings.WIKIPEDIA_PAGE_URL): + url_parts = urlparse(label) + label = urllib2.unquote(str(url_parts.path.split('/')[-1])).decode("utf-8") + wp_res = query_wikipedia_title(site, label=label) new_label = wp_res['new_label'] alternative_label= wp_res['alternative_label']