[Pywikipedia-l] SVN: [5682] trunk/pywikipedia/commonscat.py
filnik at svn.wikimedia.org
filnik at svn.wikimedia.org
Sun Jul 6 15:01:39 UTC 2008
Revision: 5682
Author: filnik
Date: 2008-07-06 15:01:37 +0000 (Sun, 06 Jul 2008)
Log Message:
-----------
The patch wasn't working because the page where I tested was changed without my knowledge.. now it works
Modified Paths:
--------------
trunk/pywikipedia/commonscat.py
Modified: trunk/pywikipedia/commonscat.py
===================================================================
--- trunk/pywikipedia/commonscat.py 2008-07-06 13:20:50 UTC (rev 5681)
+++ trunk/pywikipedia/commonscat.py 2008-07-06 15:01:37 UTC (rev 5682)
@@ -154,7 +154,7 @@
ignoreTemplates = {
'en' : [u'Category redirect', u'Commons', u'Commonscat', u'Commonscat1A', u'Commoncats', u'Commonscat4Ra', u'Sisterlinks', u'Sisterlinkswp', u'Tracking category', u'Template category', u'Wikipedia category'],
- 'it' : [u'Ip|commons=', 'Interprogetto|commons='],
+ 'it' : [(u'Ip', 'commons='), ('Interprogetto', 'commons=')],
'ja' : [u'CommonscatS'],
'nl' : [u'Commons'],
}
@@ -173,9 +173,16 @@
Do we want to skip this page?
'''
if ignoreTemplates.has_key(page.site().language()):
- for template in page.templates():
- if template in ignoreTemplates[page.site().language()]:
- return True
+ templatesInThePage = page.templates()
+ templatesWithParams = page.templatesWithParams()
+ for template in ignoreTemplates[page.site().language()]:
+ if type(template) != type(tuple()):
+ if template in templatesInThePage:
+ return True
+ else:
+ for (inPageTemplate, param) in templatesWithParams:
+ if inPageTemplate == template[0] and template[1] in param[0]:
+ return True
return False
def updateInterwiki (wikipediaPage = None, commonsPage = None):
More information about the Pywikipedia-l
mailing list