jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/282517 )
Change subject: [compat2core] Add information about templatesWithParams
......................................................................
[compat2core] Add information about templatesWithParams
- templatesWithParams() has a breaking change between compat and core.
As this was done in the first implementation for core, we shouldn't
change its behavior but note it in README-conversion.txt and give a
warning in compat2core.py utility script.
- Also correct the docstring of the method: templatesWithParams is not
a generator but returns a list of tuples with two items,
a Page object and a list of parameters.
Bug: T131952
Change-Id: I9ef501f7271d126d5720cec3ad48dcb21740f96b
---
M README-conversion.txt
M pywikibot/page.py
M scripts/maintenance/compat2core.py
3 files changed, 12 insertions(+), 5 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index 381c4a7..d67b702 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -89,6 +89,9 @@
The following methods have had their outputs changed:
- getVersionHistory(): Returns a pywikibot.Timestamp object instead of a MediaWiki one
+- templatesWithParams(): Returns a list of tuples with two items. The first item is
+ a Page object of the template, the second is a list of parameters. In compat we have
+ a list of tuples with two items. The first item is the template title.
=== FilePage objects ===
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 2f525b8..e953da0 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2191,12 +2191,12 @@
@deprecate_arg("get_redirect", None)
def templatesWithParams(self):
"""
- Iterate templates used on this Page.
+ Return templates used on this Page.
- @return: a generator that yields a tuple for each use of a template
+ @return: a list that contains a tuple for each use of a template
in the page, with the template Page as the first entry and a list of
parameters as the second entry.
- @rtype: generator
+ @rtype: list
"""
# WARNING: may not return all templates used in particularly
# intricate cases such as template substitution
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index 46c09a7..ec7a3dc 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -25,7 +25,7 @@
python pwb.py compat2core <scriptname> -warnonly
"""
#
-# (C) xqt, 2014-2015
+# (C) xqt, 2014-2017
# (C) Pywikibot team, 2014-2017
#
# Distributed under the terms of the MIT license.
@@ -117,7 +117,11 @@
'query.GetData() should be replaced by pywikibot.data.api.Request or\n'
'by a direct site request'),
('.verbose',
- 'verbose_output need "from pywikibot import config" first')
+ 'verbose_output need "from pywikibot import config" first'),
+ ('templatesWithParams(',
+ 'the first item of each template info is a Page object of the template,\n'
+ 'not the title. '
+ 'Please refer README-conversion.txt and the documentation.'),
)
--
To view, visit https://gerrit.wikimedia.org/r/282517
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9ef501f7271d126d5720cec3ad48dcb21740f96b
Gerrit-PatchSet: 7
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/343446 )
Change subject: basic.py: Fix typos
......................................................................
basic.py: Fix typos
Change-Id: Ic892c92ab58dd23a63f080af466bcbc164f8c211
---
M scripts/basic.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Sn1per: Looks good to me, approved
diff --git a/scripts/basic.py b/scripts/basic.py
index 489a067..0f3879b 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -90,7 +90,7 @@
# call constructor of the super class
super(BasicBot, self).__init__(site=True, **kwargs)
- # handle old -dry paramter
+ # handle old -dry parameter
self._handle_dry_param(**kwargs)
# assign the generator to the bot
@@ -185,7 +185,7 @@
pywikibot.input('Please enter a value for ' + arg)
options[option] = value
# take the remaining options as booleans.
- # You will get a hint if they aren't pre-definded in your bot class
+ # You will get a hint if they aren't pre-defined in your bot class
else:
options[option] = True
--
To view, visit https://gerrit.wikimedia.org/r/343446
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic892c92ab58dd23a63f080af466bcbc164f8c211
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Sn1per <geofbot(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>