Revision: 7759 Author: xqt Date: 2009-12-10 17:03:54 +0000 (Thu, 10 Dec 2009)
Log Message: ----------- Added a list of templates for skipping under-construction pages or maybe deletd. (feature request #2788690)
Modified Paths: -------------- trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py =================================================================== --- trunk/pywikipedia/interwiki.py 2009-12-10 15:15:11 UTC (rev 7758) +++ trunk/pywikipedia/interwiki.py 2009-12-10 17:03:54 UTC (rev 7759) @@ -514,6 +514,16 @@ 'zh' : (u'documentation', u'/doc'), }
+# A list of template names in different languages. +# Pages which contains these shouldn't be changed. +ignoreTemplates = { + '_default': [u'delete'], + 'cs' : [u'Pracuje_se'], + 'de' : [u'inuse', u'löschen', u'sla'], + 'en' : [u'inuse'], + 'pdc': [u'lösche'], +} + class Global(object): """Container class for global settings. Use of globals outside of this is to be avoided.""" @@ -2081,14 +2091,23 @@ return mods, mcomment, adding, removing, modifying
def botMayEdit (page): + tmpl = [] try: tmpl, loc = moved_links[page.site().lang] except KeyError: - return True - templates = page.templatesWithParams(get_redirect=True); - for template in templates: - if template[0].lower() in tmpl: - return False + pass + if type(tmpl) != list: + tmpl = tmpl.split() + try: + tmpl += ignoreTemplates[page.site().lang] + except KeyError: + pass + tmpl += ignoreTemplates['_default'] + if tmpl != []: + templates = page.templatesWithParams(get_redirect=True); + for template in templates: + if template[0].lower() in tmpl: + return False return True
def readWarnfile(filename, bot):