Revision: 7732 Author: alexsh Date: 2009-12-04 14:51:07 +0000 (Fri, 04 Dec 2009)
Log Message: ----------- fix -lang no work, and comment out zh regex cause no using and changed for logn time (re-checking current datas).
Modified Paths: -------------- trunk/pywikipedia/blockpageschecker.py
Modified: trunk/pywikipedia/blockpageschecker.py =================================================================== --- trunk/pywikipedia/blockpageschecker.py 2009-12-03 18:28:57 UTC (rev 7731) +++ trunk/pywikipedia/blockpageschecker.py 2009-12-04 14:51:07 UTC (rev 7732) @@ -82,7 +82,7 @@ r'{{(?:[Tt]emplate:|)[Aa]bp(?:|[ _]scad|(?:.*?))}}'], 'fr': [ur'{{(?:[Tt]emplate:|[Mm]odèle:|)[Ss]emi[- ]?protection(|[^}]*)}}'], 'ja':[ur'(?<!<nowiki>){{(?:[Tt]emplate:|)半保護(?:[Ss]|)(?:|.+|)}}(?!</nowiki>)\s*(?:\r\n|)*'], - 'zh':[ur'{{(?:[Tt]emplate:|)Protected|(?:[Ss]|[Ss]emi|半)(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Mini-protected|(?:[Ss]|[Ss]emi|半)(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Protected-logo|(?:[Ss]|[Ss]emi|半)(?:|.+|)}}(\n+?|)'], + #'zh':[ur'{{(?:[Tt]emplate:|)Protected|(?:[Ss]|[Ss]emi|半)(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Mini-protected|(?:[Ss]|[Ss]emi|半)(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Protected-logo|(?:[Ss]|[Ss]emi|半)(?:|.+|)}}(\n+?|)'], } # Regex to get the total-protection template templateTotalProtection = { @@ -92,21 +92,21 @@ 'fr':[ur'{{(?:[Tt]emplate:|[Mm]odèle:|)[Pp]rotection(|[^}]*)}}', ur'{{(?:[Tt]emplate:|[Mm]odèle:|)(?:[Pp]age|[Aa]rchive|[Mm]odèle) protégée?(|[^}]*)}}'], 'ja':[ur'(?<!<nowiki>){{(?:[Tt]emplate:|)保護(?:性急|)(?:[Ss]|)(?:|.+|)}}(?!</nowiki>)\s*(?:\r\n|)*'], - 'zh':[r'{{(?:[Tt]emplate:|)Protected|(?:[Nn]|[Nn]ormal)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Mini-protected|(?:[Nn]|[Nn]ormal)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Protected-logo|(?:[Nn]|[Nn]ormal)(?:|.+|)}}(\n+?|)'], + #'zh':[r'{{(?:[Tt]emplate:|)Protected|(?:[Nn]|[Nn]ormal)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Mini-protected|(?:[Nn]|[Nn]ormal)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Protected-logo|(?:[Nn]|[Nn]ormal)(?:|.+|)}}(\n+?|)'], } # Regex to get the semi-protection move template templateSemiMoveProtection = { 'en': None, 'it':[r'{{(?:[Tt]emplate:|)[Aa]vvisobloccospostamento(?:|[ _]scad|.*?||.*?)}}'], 'ja':[ur'(?<!<nowiki>){{(?:[Tt]emplate:|)移動半保護(?:[Ss]|)(?:|.+|)}}(?!</nowiki>)\s*(?:\r\n|)*'], - 'zh':[r'{{(?:[Tt]emplate:|)Protected|(?:MS|ms)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Mini-protected|(?:MS|ms)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Protected-logo|(?:MS|ms)(?:|.+|)}}(\n+?|)'], + #'zh':[r'{{(?:[Tt]emplate:|)Protected|(?:MS|ms)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Mini-protected|(?:MS|ms)(?:|.+|)}}(\n+?|)',r'{{(?:[Tt]emplate:|)Protected-logo|(?:MS|ms)(?:|.+|)}}(\n+?|)'], } # Regex to get the total-protection move template templateTotalMoveProtection = { 'en': None, 'it':[r'{{(?:[Tt]emplate:|)[Aa]vvisobloccospostamento(?:|[ _]scad|.*?||.*?)}}'], 'ja':[ur'(?<!<nowiki>){{(?:[Tt]emplate:|)移動保護(?:[Ss]|)(?:|.+|)}}(?!</nowiki>)\s*(?:\r\n|)*'], - 'zh':[ur'{{(?:[Tt]emplate:|)Protected|(?:[Mm]|[Mm]ove|移[動动])(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Mini-protected|(?:[Mm]|[Mm]ove|移[動动])(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Protected-logo|(?:[Mm]|[Mm]ove|移[動动])(?:|.+|)}}(\n+?|)'], + #'zh':[ur'{{(?:[Tt]emplate:|)Protected|(?:[Mm]|[Mm]ove|移[動动])(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Mini-protected|(?:[Mm]|[Mm]ove|移[動动])(?:|.+|)}}(\n+?|)',ur'{{(?:[Tt]emplate:|)Protected-logo|(?:[Mm]|[Mm]ove|移[動动])(?:|.+|)}}(\n+?|)'], }
# If you use only one template for all the type of protection, put it here. @@ -122,7 +122,7 @@ 'it':['{{Avvisobloccoparziale}}', '{{Avvisoblocco}}', None, None, '{{Protetta}}'], 'fr':['{{Semi-protection}}', '{{Protection}}', None, None, None], 'ja':[u'{{半保護}}', u'{{保護}}', u'{{移動半保護}}', u'{{移動保護}}', None], - 'zh':[u'{{Protected/semi}}',u'{{Protected}}',u'{{Protected/ms}}',u'{{Protected/move}}', None], + #'zh':[u'{{Protected/semi}}',u'{{Protected}}',u'{{Protected/ms}}',u'{{Protected/move}}', None], }
# Category where the bot will check @@ -206,7 +206,7 @@ def main(): """ Main Function """ # Loading the comments - global categoryToCheck; global comment; global project_inserted + global categoryToCheck, comment, project_inserted if config.mylang not in project_inserted: pywikibot.output(u"Your project is not supported by this script. You have to edit the script and add it!") return @@ -215,8 +215,6 @@ moveBlockCheck = False; genFactory = pagegenerators.GeneratorFactory() # To prevent Infinite loops errorCount = 0 - # Load the right site - site = pywikibot.getSite() # Loading the default options. for arg in pywikibot.handleArgs(): if arg == '-always': @@ -244,6 +242,9 @@ else: genFactory.handleArg(arg)
+ # Load the right site + site = pywikibot.getSite() + # Take the right templates to use, the category and the comment TSP = pywikibot.translate(site, templateSemiProtection) TTP = pywikibot.translate(site, templateTotalProtection)
pywikipedia-svn@lists.wikimedia.org