http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10888
Revision: 10888 Author: drtrigon Date: 2013-01-11 22:29:36 +0000 (Fri, 11 Jan 2013) Log Message: ----------- bug fix; pretty printer did not work (make dict first) bug fix; bot edit comment listed a lot more tags than actually updated (all after first change)
Modified Paths: -------------- trunk/pywikipedia/subster.py
Modified: trunk/pywikipedia/subster.py =================================================================== --- trunk/pywikipedia/subster.py 2013-01-11 22:18:43 UTC (rev 10887) +++ trunk/pywikipedia/subster.py 2013-01-11 22:29:36 UTC (rev 10888) @@ -291,7 +291,6 @@ """
substed_tags = [] # DRTRIGON-73 - prev_content = content
# 0.2.) check for 'simple' mode and get additional params if param['simple']: @@ -337,7 +336,7 @@ if (param['url'][8:] == u'cache/state_bots'): # filename hard-coded d = shelve.open(pywikibot.config.datafilepath('cache', 'state_bots')) - external_buffer = pprint.pformat(d) + external_buffer = pprint.pformat(ast.literal_eval(pprint.pformat(d))) d.close() else: external_buffer = u'n/a' @@ -403,6 +402,7 @@ logging.getLogger('subster').debug( external_data )
# 5.) subst content + prev_content = content var_regex = self.get_var_regex(value) content = var_regex.sub((self._var_regex_str%{'var':value,'cont':external_data}), content, int(param['count'])) if (content != prev_content): @@ -418,6 +418,8 @@
pywikibot.output(u'BeautifulSoup tags found by regex: %i' % len(BS_tags))
+ prev_content = content + BS = BeautifulSoup.BeautifulSoup(external_buffer) for item in BS_tags: external_data = eval('BS.%s' % item[1])
pywikipedia-svn@lists.wikimedia.org