[Pywikipedia-l] SVN: [6278] trunk/pywikipedia/imagerecat.py

multichill at svn.wikimedia.org multichill at svn.wikimedia.org
Thu Jan 22 23:09:43 UTC 2009


Revision: 6278
Author:   multichill
Date:     2009-01-22 23:09:43 +0000 (Thu, 22 Jan 2009)

Log Message:
-----------
Fixing another bug introduced in 6270.
Adding ncats.

Modified Paths:
--------------
    trunk/pywikipedia/imagerecat.py

Modified: trunk/pywikipedia/imagerecat.py
===================================================================
--- trunk/pywikipedia/imagerecat.py	2009-01-22 16:17:03 UTC (rev 6277)
+++ trunk/pywikipedia/imagerecat.py	2009-01-22 23:09:43 UTC (rev 6278)
@@ -258,7 +258,7 @@
 
     if not(onlyfilter):
         newtext = removeTemplates(newtext)
-        newtext = newtext + getCheckCategoriesTemplate(usage, galleries)
+        newtext = newtext + getCheckCategoriesTemplate(usage, galleries, len(newcats))
     for category in newcats:
         newtext = newtext + u'[[Category:' + category + u']]\n'
 
@@ -282,7 +282,7 @@
     result = re.sub(u'\{\{\s*[Cc]heck categories[^}]*\}\}', u'', result)
     return result
 
-def getCheckCategoriesTemplate(usage, galleries):
+def getCheckCategoriesTemplate(usage, galleries, ncats):
     result = u'{{Check categories|year={{subst:CURRENTYEAR}}|month={{subst:CURRENTMONTHNAME}}|day={{subst:CURRENTDAY}}\n'
 
     usageCounter = 1
@@ -297,7 +297,8 @@
     for gallery in galleries:
         result = result + u'|gallery' + str(galleryCounter) + u'=' + gallery.replace('_', ' ') + u'\n'
         galleryCounter = galleryCounter + 1
-
+    
+    result = result + u'ncats='+ str(ncats) + u'\n'
     result = result + u'}}\n'
     return result    
 
@@ -318,7 +319,7 @@
         else:
             genFactory.handleArg(arg)
 
-    gen = genFactory.getCombinedGenerator()
+    generator = genFactory.getCombinedGenerator()
     if not generator:
         generator = pagegenerators.CategorizedPageGenerator(catlib.Category(site, u'Category:Media needing categories'), recurse=True)
 





More information about the Pywikipedia-l mailing list