http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11023
Revision: 11023 Author: drtrigon Date: 2013-02-02 11:29:35 +0000 (Sat, 02 Feb 2013) Log Message: ----------- bug fix; preserve 'url' (e.g. 'wiki://') in params dict (compatibility with other code)
Modified Paths: -------------- trunk/pywikipedia/subster.py
Modified: trunk/pywikipedia/subster.py =================================================================== --- trunk/pywikipedia/subster.py 2013-02-01 20:12:01 UTC (rev 11022) +++ trunk/pywikipedia/subster.py 2013-02-02 11:29:35 UTC (rev 11023) @@ -354,19 +354,19 @@ secure = False for item in [u'http://', u'https://', u'mail://', u'local://', u'wiki://']: secure = secure or (param['url'][:len(item)] == item) - param['zip'] = ast.literal_eval(param['zip']) + param['zip'] = ast.literal_eval(param['zip']) if not secure: return (content, substed_tags, metadata) if (param['url'][:7] == u'wiki://'): - param['url'] = param['url'][7:].strip('[]') # enable wiki-links + url = param['url'][7:].strip('[]') # enable wiki-links if ast.literal_eval(param['expandtemplates']): # DRTRIGON-93 (only with 'wiki://') - external_buffer = pywikibot.Page(self.site, param['url']).get(expandtemplates=True) + external_buffer = pywikibot.Page(self.site, url).get(expandtemplates=True) else: - external_buffer = self.load( pywikibot.Page(self.site, param['url']) ) + external_buffer = self.load( pywikibot.Page(self.site, url) ) elif (param['url'][:7] == u'mail://'): # DRTRIGON-101 - param['url'] = param['url'].replace(u'{{@}}', u'@') # e.g. nlwiki + url = param['url'].replace(u'{{@}}', u'@') # e.g. nlwiki mbox = SubsterMailbox(pywikibot.config.datafilepath(bot_config['data_path'], bot_config['mbox_file'], '')) - external_buffer = mbox.find_data(param['url']) + external_buffer = mbox.find_data(url) mbox.close() elif (param['url'][:8] == u'local://'): # DRTRIGON-131 if (param['url'][8:] == u'cache/state_bots'):