Revision: 6249 Author: russblau Date: 2009-01-12 13:44:28 +0000 (Mon, 12 Jan 2009)
Log Message: ----------- handleArgs() bug and aslink() formatting
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-01-10 23:14:13 UTC (rev 6248) +++ trunk/pywikipedia/wikipedia.py 2009-01-12 13:44:28 UTC (rev 6249) @@ -586,12 +586,13 @@ if not noInterwiki and (forceInterwiki or self.site() != getSite()): 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]]' % (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]]' % (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: @@ -6194,14 +6195,14 @@ global default_code, default_family, verbose # get commandline arguments if not args: - args = sys.argv + args = sys.argv[1:] # get the name of the module calling this function. This is # required because the -help option loads the module's docstring and because # the module name will be used for the filename of the log. # TODO: check if the following line is platform-independent moduleName = calledModuleName() nonGlobalArgs = [] - for arg in args[1:]: + for arg in args: arg = decodeArg(arg) if arg == '-help': showHelp(moduleName)
Revision 6249 introduced a critical bug for interwiki bots: the asLink() format changed from [[lang:page]] to [[:lang:page]]:
On Mon, January 12, 2009 2:44 pm, russblau@svn.wikimedia.org wrote:
return u'[[%s:%s:%s]]' % (self.site().family.name,
(...)
return u'[[:%s:%s:%s]]' % (self.site().family.name,
(...)
return u'[[%s:%s]]' % (self.site().lang,
(...)
return u'[[:%s:%s]]' % (self.site().lang,
This makes sense for an asLink function, but it broke the current interwiki functionality: interwiki links -the sidebar type- were replaced by links -the inline type-.
This bug has been fixed in r6250: the interwiki functions now strip the :.
If you run an interwiki bot, update from r6249 to r6250 /immediatly/, please. The wrongly created links will /not/ be removed by the bot!
Best regards, Merlijn 'valhallasw' van Deen
pywikipedia-l@lists.wikimedia.org