Revision: 8785 Author: valhallasw Date: 2010-12-21 00:11:55 +0000 (Tue, 21 Dec 2010) Log Message: ----------- Follow-up to r8784: introducing iwkeys
The changes by purodha seem to have some more side effects due to tight coupling inside the library code. This commit fixes some additional interwiki mess [1], but I am *uncertain* of any new introduced side- effects.
If any more issues arise, I suggest reverting purodha changes and first applying the changes in a feature branch. Or, possibly, only in the rewrite branch.
[1] http://commons.wikimedia.org/w/index.php?title=Category:Tre_kronor_af_Stockh...
Modified Paths: -------------- trunk/pywikipedia/family.py trunk/pywikipedia/redirect.py trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/family.py =================================================================== --- trunk/pywikipedia/family.py 2010-12-20 22:14:07 UTC (rev 8784) +++ trunk/pywikipedia/family.py 2010-12-21 00:11:55 UTC (rev 8785) @@ -3539,6 +3539,13 @@ # self.crossnamespace[102] = { # 'pt': { '_default': [0]} # } + + @property + def iwkeys(self): + if self.interwiki_forward: + import wikipedia as pywikibot + return pywikibot.Family(self.interwiki_forward).langs.keys() + return self.langs.keys()
def _addlang(self, code, location, namespaces = {}): """Add a new language to the langs and namespaces of the family.
Modified: trunk/pywikipedia/redirect.py =================================================================== --- trunk/pywikipedia/redirect.py 2010-12-20 22:14:07 UTC (rev 8784) +++ trunk/pywikipedia/redirect.py 2010-12-21 00:11:55 UTC (rev 8785) @@ -247,7 +247,7 @@ if m: target = m.group(1) # There might be redirects to another wiki. Ignore these. - for code in self.site.family.langs.keys(): + for code in self.site.family.iwkeys: if target.startswith('%s:' % code) \ or target.startswith(':%s:' % code): if code == self.site.language():
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2010-12-20 22:14:07 UTC (rev 8784) +++ trunk/pywikipedia/wikipedia.py 2010-12-21 00:11:55 UTC (rev 8785) @@ -7381,7 +7381,7 @@
def languages(self): """Return list of all valid language codes for this site's Family.""" - return self.family.langs.keys() + return self.family.iwkeys
def validLanguageLinks(self): """Return list of language codes that can be used in interwiki links."""