Revision: 8702 Author: filnik Date: 2010-11-06 13:20:55 +0000 (Sat, 06 Nov 2010) Log Message: ----------- Bugfix for move-block
Modified Paths: -------------- trunk/pywikipedia/blockpageschecker.py
Modified: trunk/pywikipedia/blockpageschecker.py =================================================================== --- trunk/pywikipedia/blockpageschecker.py 2010-11-06 03:10:04 UTC (rev 8701) +++ trunk/pywikipedia/blockpageschecker.py 2010-11-06 13:20:55 UTC (rev 8702) @@ -254,7 +254,7 @@ category = pywikibot.translate(site, categoryToCheck) commentUsed = pywikibot.translate(site, comment) if not generator: - gen = genFactory.getCombinedGenerator() + generator = genFactory.getCombinedGenerator() if not generator: generator = list() pywikibot.output(u'Loading categories...') @@ -319,7 +319,10 @@ text, changes = re.subn('<noinclude>(%s)</noinclude>' % replaceToPerform, '', text) if changes == 0: text, changes = re.subn('(%s)' % replaceToPerform, '', text) - pywikibot.output(u'The page is editable for all, deleting the template...') + msg = u'The page is editable for all' + if not moveBlockCheck: + msg += ", deleting the template.." + pywikibot.output(msg)
elif editRestr[0] == 'sysop': # total edit protection @@ -372,23 +375,27 @@ # move-total-protection if (TemplateInThePage[0] == 'sysop-move' and TTMP != None) or (TemplateInThePage[0] == 'unique' and TU != None): pywikibot.output(u'The page is protected from moving to the sysop, skipping...') + if TU != None: + text = oldtext # no changes needed, better to revert the old text. else: pywikibot.output(u'The page is protected from moving to the sysop, but the template seems not correct. Fixing...') - if TU != None: - text, changes = re.subn(TemplateInThePage[1], TNR[4], text) - else: - text, changes = re.subn(TemplateInThePage[1], TNR[3], text) + if TU != None: + text, changes = re.subn(TemplateInThePage[1], TNR[4], text) + else: + text, changes = re.subn(TemplateInThePage[1], TNR[3], text)
elif TSMP != None or TU != None: # implicitely moveRestr[0] = 'autoconfirmed', move-semi-protection if TemplateInThePage[0] == 'autoconfirmed-move' or TemplateInThePage[0] == 'unique': pywikibot.output(u'The page is movable only for the autoconfirmed users, skipping...') + if TU != None: + text = oldtext # no changes needed, better to revert the old text. else: pywikibot.output(u'The page is movable only for the autoconfirmed users, but the template seems not correct. Fixing...') - if TU != None: - text, changes = re.subn(TemplateInThePage[1], TNR[4], text) - else: - text, changes = re.subn(TemplateInThePage[1], TNR[2], text) + if TU != None: + text, changes = re.subn(TemplateInThePage[1], TNR[4], text) + else: + text, changes = re.subn(TemplateInThePage[1], TNR[2], text)
if changes == 0: # We tried to fix move-protection templates, but it did not work.