Revision: 5243 Author: nicdumz Date: 2008-04-20 22:34:58 +0000 (Sun, 20 Apr 2008)
Log Message: ----------- * Correcting a wrong output in redirect.py * Correcting the behavior of Page when given "w:page" as a title, when working on meta or commons : the default language overthere is english, but we defaulted to self.site().lang, i.e. "meta" or "commons", which was wrong and was raising "wikipedia.NoSuchSite: Language meta does not exist in family wikipedia"
Modified Paths: -------------- trunk/pywikipedia/redirect.py trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/redirect.py =================================================================== --- trunk/pywikipedia/redirect.py 2008-04-20 11:38:33 UTC (rev 5242) +++ trunk/pywikipedia/redirect.py 2008-04-20 22:34:58 UTC (rev 5243) @@ -326,8 +326,10 @@ wikipedia.output( u'Redirect target is also a redirect! Won't delete anything.') else: + #we successfully get the target page, meaning that + #it exists and is not a redirect: no reason to touch it. wikipedia.output( - u'Redirect target does not exist! Won't delete anything.') + u'Redirect target does exist! Won't delete anything.') # idle for 1 minute wikipedia.output(u'') wikipedia.put_throttle()
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-04-20 11:38:33 UTC (rev 5242) +++ trunk/pywikipedia/wikipedia.py 2008-04-20 22:34:58 UTC (rev 5243) @@ -391,7 +391,12 @@ # This page is from a different family if verbose: output(u"Target link '%s' has different family '%s'" % (title, lowerNs)) - otherlang = self.site().lang + if self.site().family.name in ['commons', 'meta']: + #When the source wiki is commons or meta, + #w:page redirects you to w:en:page + otherlang = 'en' + else: + otherlang = self.site().lang familyName = self.site().family.get_known_families(site = self.site())[lowerNs] if familyName in ['commons', 'meta']: otherlang = familyName
pywikipedia-l@lists.wikimedia.org