http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8911
Revision: 8911
Author: russblau
Date: 2011-02-03 20:10:22 +0000 (Thu, 03 Feb 2011)
Log Message:
-----------
Add "namespaces" option for Category.articles()
Modified Paths:
--------------
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2011-02-03 13:05:23 UTC (rev 8910)
+++ branches/rewrite/pywikibot/page.py 2011-02-03 20:10:22 UTC (rev 8911)
@@ -1640,10 +1640,14 @@
return
@deprecate_arg("startFrom", None)
- def articles(self, recurse=False, step=None, total=None, content=False):
+ def articles(self, recurse=False, step=None, total=None,
+ namespaces=None, content=False):
"""
Yields all articles in the current category.
+ By default, yields all *pages* in the category that are not
+ subcategories!
+
@param recurse: if not False or 0, also iterate articles in
subcategories. If an int, limit recursion to this number of
levels. (Example: recurse=1 will iterate articles in first-level
@@ -1652,12 +1656,15 @@
@param step: limit each API call to this number of pages
@param total: iterate no more than this number of pages in
total (at all levels)
+ @param namespaces: only yield pages in the specified namespaces
+ @type namespace: int or list of ints
@param content: if True, retrieve the content of the current version
of each page (default False)
"""
- namespaces = [x for x in self.site.namespaces()
- if x>=0 and x!=14]
+ if namespaces is None:
+ namespaces = [x for x in self.site.namespaces()
+ if x>=0 and x!=14]
for member in self.site.categorymembers(self,
namespaces=namespaces,
step=step, total=total,
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/8908
Revision: 8908
Author: filnik
Date: 2011-02-01 19:25:18 +0000 (Tue, 01 Feb 2011)
Log Message:
-----------
fix commons message
Modified Paths:
--------------
trunk/pywikipedia/checkimages.py
Modified: trunk/pywikipedia/checkimages.py
===================================================================
--- trunk/pywikipedia/checkimages.py 2011-01-31 14:47:53 UTC (rev 8907)
+++ trunk/pywikipedia/checkimages.py 2011-02-01 19:25:18 UTC (rev 8908)
@@ -417,7 +417,7 @@
# Note: every __botnick__ will be repleaced with your bot's nickname (feel free not to use if you don't need it)
HiddenTemplateNotification = {
'_default':None,
- 'commons': u"""\n{{subst:User:Filnik/whitetemplate|File:%s}}\n\n''This message was '''added automatically by [[User:__botnick__|__botnick__]]''', if you need some help about it, ask its master (~~~) or go to the [[Commons:Help desk]]''. --~~~~""",
+ 'commons': u"""\n{{subst:User:Filnik/whitetemplate|File:%s}}\n\n''This message was added automatically by __botnick__, if you need some help about it please read the text above again and follow the links in it, if you still need help ask at the [[File:Human-help-browser.svg|18px|link=Commons:Help desk|?]] '''[[Commons:Help desk|→]] [[Commons:Help desk]]''' in any language you like to use.'' --__botnick__""",
'it' : u"{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Template_insufficiente|%s|__botnick__}} --~~~~",
'ko' : u"\n{{subst:User:Kwj2772/whitetemplates|%s}} --~~~~",
}