Revision: 6251 Author: russblau Date: 2009-01-13 13:38:39 +0000 (Tue, 13 Jan 2009)
Log Message: ----------- fix interwiki problem
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-01-12 19:47:25 UTC (rev 6250) +++ trunk/pywikipedia/wikipedia.py 2009-01-13 13:38:39 UTC (rev 6251) @@ -578,21 +578,25 @@ points to the home wiki. If False, return an interwiki link only if needed.
- If textlink is True, always return a link in text form (that - is, links to the Category: and Image: namespaces will be preceded by - a : character). (Not needed if forceInterwiki is True.) + If textlink is True, always return a link in text form (that is, + interwiki links and internal links to the Category: and Image: + namespaces will be preceded by a : character).
""" if not noInterwiki and (forceInterwiki or self.site() != getSite()): + if textlink: + left = "[[:" + else: + left = "[[" if self.site().family != getSite().family \ and self.site().family.name != self.site().lang: - return u'[[:%s:%s:%s]]' % (self.site().family.name, - self.site().lang, - self.title(savetitle=True, - decode=True)) + return u'%s%s:%s:%s]]' % (left, self.site().family.name, + self.site().lang, + self.title(savetitle=True, + decode=True)) else: - return u'[[:%s:%s]]' % (self.site().lang, - self.title(savetitle=True, decode=True)) + return u'%s%s:%s]]' % (left, self.site().lang, + self.title(savetitle=True, decode=True)) elif textlink and (self.isImage() or self.isCategory()): return u'[[:%s]]' % self.title(savetitle=True, decode=True) else:
pywikipedia-l@lists.wikimedia.org