jenkins-bot has submitted this change and it was merged.
Change subject: Code style improvement
......................................................................
Code style improvement
Using "if not total:", although technically correct, is confusing
when an integer is expected, and makes code maintenance more difficult.
Replace with "if total == 0:" which is easier to understand.
Change-Id: I5571600cf180bca7c700f2ada148dbd580b25250
---
M pywikibot/page.py
1 file changed, 8 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 43111d0..fe54ef6 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1812,7 +1812,7 @@
yield subcat
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
for item in subcat.subcategories(
@@ -1820,14 +1820,14 @@
yield item
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
else:
for subcat in self._subcats:
yield subcat
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
for item in subcat.subcategories(
@@ -1835,7 +1835,7 @@
yield item
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
@deprecate_arg("startFrom", "startsort")
@@ -1895,7 +1895,7 @@
yield member
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
if not isinstance(recurse, bool) and recurse:
@@ -1913,7 +1913,7 @@
yield article
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
def members(self, recurse=False, namespaces=None, step=None, total=None,
@@ -1925,7 +1925,7 @@
yield member
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
if recurse:
if not isinstance(recurse, bool) and recurse:
@@ -1937,7 +1937,7 @@
yield article
if total is not None:
total -= 1
- if not total:
+ if total == 0:
return
def isEmptyCategory(self):
--
To view, visit https://gerrit.wikimedia.org/r/132593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5571600cf180bca7c700f2ada148dbd580b25250
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: mw version 1.24wmf3
......................................................................
mw version 1.24wmf3
Change-Id: Ib4cdf23d12c5e020f8e6d32e76583fcac73d0e6d
---
M pywikibot/family.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py
index d9af922..c422460 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1069,7 +1069,7 @@
"""Return Wikimedia projects version number as a string."""
# Don't use this, use versionnumber() instead. This only exists
# to not break family files.
- return '1.24wmf2'
+ return '1.24wmf3'
def shared_image_repository(self, code):
return ('commons', 'commons')
--
To view, visit https://gerrit.wikimedia.org/r/132334
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib4cdf23d12c5e020f8e6d32e76583fcac73d0e6d
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
Russell Blau has submitted this change and it was merged.
Change subject: Add Page.protection() method to core
......................................................................
Add Page.protection() method to core
This is similar to compat but returns a clearer dictionary from
corresponding site method.
Change-Id: I2427d5a9a62f38a4e64dfbf54577c57e2e8a07cc
---
M pywikibot/page.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Russell Blau: Verified; Looks good to me, approved
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 25e9046..76309f1 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -745,6 +745,10 @@
content=content
)
+ def protection(self):
+ """Returns a dictionary reflecting page protections"""
+ return self.site.page_restrictions(self)
+
def canBeEdited(self):
"""Return bool indicating whether this page can be edited.
--
To view, visit https://gerrit.wikimedia.org/r/131676
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2427d5a9a62f38a4e64dfbf54577c57e2e8a07cc
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)live.it>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Bug 64855 - get.py not ported from compat but added to listpages.py
......................................................................
Bug 64855 - get.py not ported from compat but added to listpages.py
Optionally, page content is retrieved and written to standard output.
This makes it possible to pipe the text to another process.
Change-Id: Ibd4717af9763d4989e36902b0210f411709f9f48
---
M scripts/listpages.py
1 file changed, 23 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/listpages.py b/scripts/listpages.py
index ec22d0e..233160a 100644
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -1,10 +1,16 @@
# -*- coding: utf-8 -*-
"""
-Print a list of pages, as defined by page generator parameters
+Print a list of pages, as defined by page generator parameters.
+Optionally, it also prints page content to STDOUT.
These parameters are supported to specify which pages titles to print:
¶ms;
+
+-notitle Page title is not printed.
+
+-get Page content is printed.
+
"""
#
# (C) Pywikibot team, 2008-2014
@@ -22,15 +28,26 @@
def main(*args):
gen = None
+ notitle = False
+ page_get = False
+
genFactory = GeneratorFactory()
for arg in pywikibot.handleArgs(*args):
- genFactory.handleArg(arg)
+ if arg == '-notitle':
+ notitle = True
+ elif arg == '-get':
+ page_get = True
+ else:
+ genFactory.handleArg(arg)
+
gen = genFactory.getCombinedGenerator()
if gen:
- i = 0
- for page in gen:
- i += 1
- pywikibot.stdout("%4d: %s" % (i, page.title()))
+ for i, page in enumerate(gen, start=1):
+ if not notitle:
+ pywikibot.stdout("%4d: %s" % (i, page.title()))
+ if page_get:
+ # TODO: catch exceptions
+ pywikibot.output(page.text, toStdout=True)
else:
pywikibot.showHelp()
--
To view, visit https://gerrit.wikimedia.org/r/131872
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd4717af9763d4989e36902b0210f411709f9f48
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Use subcategories() method instead of this roundabout method call.
......................................................................
Use subcategories() method instead of this roundabout method call.
Change-Id: Id125dade743028350148dfb00774a2dba3f3b77d
---
M scripts/category_redirect.py
1 file changed, 1 insertion(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 7aa1bc6..c60572a 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -264,8 +264,7 @@
# get a list of all members of the category-redirect category
catpages = dict((c, None)
- for c in self.site.categorymembers(redircat,
- namespaces=[14]))
+ for c in redircat.subcategories())
# check the category pages for redirected categories
pywikibot.output(u"")
--
To view, visit https://gerrit.wikimedia.org/r/131645
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id125dade743028350148dfb00774a2dba3f3b77d
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>