Revision: 8784 Author: valhallasw Date: 2010-12-20 22:14:07 +0000 (Mon, 20 Dec 2010) Log Message: ----------- orrecting asLink() behaviour after r8756/r8758/r8759 changes.
r8756-r8759 introduced changes in the interwiki handling for families such as commons: interwiki links on commons were not handled, because they link to another family. These changes implement changes to allow this. However, these changes did not take the necessary change to asLink into account, causing edits such as http://commons.wikimedia.org/w/index.php?title=Category:Triumphal_arches&...
This commits corrects the asLink behaviour by checking for the interwiki forward information in the family files.
As a quick check, I think this might allow interwiki.py to work directly, although this behaviour has been blocked explicitly in r8762.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2010-12-20 05:25:30 UTC (rev 8783) +++ trunk/pywikipedia/wikipedia.py 2010-12-20 22:14:07 UTC (rev 8784) @@ -466,12 +466,18 @@ except TypeError: print title, begin, anchor raise + if asLink: - if allowInterwiki and (forceInterwiki or self._site != getSite()): + iw_target_site = getSite() + iw_target_family = getSite().family + if iw_target_family.interwiki_forward: + iw_target_family = pywikibot.Family(iw_target_family.interwiki_forward) + + if allowInterwiki and (forceInterwiki or self._site != iw_target_site): colon = "" if textlink: colon = ":" - if self._site.family != getSite().family \ + if self._site.family != iw_target_family \ and self._site.family.name != self._site.lang: title = u'[[%s%s:%s:%s]]' % (colon, self._site.family.name, self._site.lang, title)