Revision: 7036
Author: multichill
Date: 2009-07-09 12:16:32 +0000 (Thu, 09 Jul 2009)
Log Message:
-----------
Fix bug introduced in 6770:
Links in delinks by a local delinker shouldn't be redirected to Commons. Only change link to Commons when the bot is running in global mode.
Modified Paths:
--------------
trunk/pywikipedia/commonsdelinker/delinker.py
Modified: trunk/pywikipedia/commonsdelinker/delinker.py
===================================================================
--- trunk/pywikipedia/commonsdelinker/delinker.py 2009-07-09 10:14:28 UTC (rev 7035)
+++ trunk/pywikipedia/commonsdelinker/delinker.py 2009-07-09 12:16:32 UTC (rev 7036)
@@ -343,8 +343,8 @@
def get_summary(self, site, image, admin, reason, replacement):
""" Get the summary template and substitute the
correct values."""
- # FIXME: Hardcode is EVIL
- if site.lang != 'commons':
+ # FIXME: Hardcode is EVIL, but now only the global bot uses this
+ if (site.lang != 'commons' and self.CommonsDelinker.config['global']):
reason = reason.replace('[[', '[[commons:')
if replacement:
tlp = self.CommonsDelinker.SummaryCache.get(site, 'replace-I18n')
Revision: 7035
Author: alexsh
Date: 2009-07-09 10:14:28 +0000 (Thu, 09 Jul 2009)
Log Message:
-----------
Set the same lang and same project name when proect has one site only, it's no set -lang parameter when running script.just set -family could run.(tested on mediawiki and meta family files)
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2009-07-09 10:11:29 UTC (rev 7034)
+++ trunk/pywikipedia/wikipedia.py 2009-07-09 10:14:28 UTC (rev 7035)
@@ -4388,6 +4388,8 @@
if self.lang == 'zh-classic' and 'zh-classical' in self.languages():
self.lang = 'zh-classical'
# ev0l database hack (database is varchar[10] -> zh-classical is cut to zh-classic.
+ elif self.family.name in self.family.langs.keys() or len(self.family.langs) == 1:
+ self.lang = self.family.name
else:
raise NoSuchSite("Language %s does not exist in family %s"%(self.lang,self.family.name))