jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/412494 )
Change subject: [cleanup] remove unsupported get_redirect parameter
......................................................................
[cleanup] remove unsupported get_redirect parameter
- Page.templates() and Page.templatesWithParams() doesn't support
get_redirect parameter anymore
- deprecate get_redirect for Page.templates() method
- Show warning for different behaviour between compat and core for
Page.templates() method
Change-Id: I97f2db8ed25ac80039103735cf6844c784310b1f
---
M pywikibot/page.py
M scripts/maintenance/compat2core.py
M scripts/solve_disambiguation.py
3 files changed, 6 insertions(+), 4 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 6cff93b..7d1babf 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1540,6 +1540,7 @@
"""DEPRECATED. Use templates()."""
return self.templates()
+ @deprecate_arg('get_redirect', None)
def templates(self, content=False):
"""
Return a list of Page objects for templates used on this Page.
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index 4e62b64..49ec2fc 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -121,6 +121,8 @@
'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.'),
+ ('templates(',
+ 'returns a list of template title not a list of templage page objects.'),
)
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 49d22a7..dc82dfb 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -614,7 +614,7 @@
}
primary_redir_template = {
- # Page.templates() format, first letter uppercase
+ # First letter uppercase
'hu': u'Egyért-redir',
}
@@ -1008,10 +1008,9 @@
if disambPage.isRedirectPage() and not self.primary:
if (disambPage.site.lang in self.primary_redir_template and
self.primary_redir_template[disambPage.site.lang]
- in disambPage.templates(get_redirect=True)):
+ in disambPage.templates()):
baseTerm = disambPage.title()
- for template in disambPage.templatesWithParams(
- get_redirect=True):
+ for template in disambPage.templatesWithParams():
if template[0] == self.primary_redir_template[
disambPage.site.lang] \
and len(template[1]) > 0:
--
To view, visit https://gerrit.wikimedia.org/r/412494
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I97f2db8ed25ac80039103735cf6844c784310b1f
Gerrit-Change-Number: 412494
Gerrit-PatchSet: 3
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: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/420170 )
Change subject: [bugfix] Set default current_page on top
......................................................................
[bugfix] Set default current_page on top
current_page must be set on each treat call
but due to its magic it must be set only once.
Therefore use a local variable.
Bug: T189635
Change-Id: If963578b2a39219e52208d9f62f3287b3643ab26
---
M scripts/category.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Zhuyifei1999: Looks good to me, but someone else must approve
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index bedd4c9..1aade2f 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -349,17 +349,17 @@
# loading it will throw an error if we don't jump out before
return
else:
+ current_page = page
if page.namespace() == page.site.namespaces.TEMPLATE:
docs = page.site.doc_subpage # return tuple
for doc in docs:
doc_page = pywikibot.Page(
page.site, page.title() + doc)
if doc_page.exists():
- self.current_page = doc_page
+ current_page = doc_page
includeonly = ['includeonly']
break
- if not self.current_page:
- self.current_page = page
+ self.current_page = current_page
if self.current_page.exists():
# Load the page
text = self.current_page.text
--
To view, visit https://gerrit.wikimedia.org/r/420170
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If963578b2a39219e52208d9f62f3287b3643ab26
Gerrit-Change-Number: 420170
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/420241 )
Change subject: [cleanup] Remove old httplib2 code part
......................................................................
[cleanup] Remove old httplib2 code part
- with 2.0 release httplib2 was used instead of requests and
externals/httplib2 was loaded package of that name, even if
the directory was empty because the user has not cloned the
git sub-modules.
Now under 3.0 release we haven't that externals package anymore
but a side package with requests and it is no longer needed to
check the __version__ string.
- Also simplify pwb assignment in tryimport procedure.
Change-Id: Iadcc9174f51d7f634cfec048df61a3df8379dc14
---
M pwb.py
1 file changed, 3 insertions(+), 13 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index 8c6b31b..082e353 100755
--- a/pwb.py
+++ b/pwb.py
@@ -72,13 +72,11 @@
global pwb
try:
import pywikibot
- pwb = pywikibot
except RuntimeError:
remove_modules()
-
os.environ['PYWIKIBOT2_NO_USER_CONFIG'] = '2'
import pywikibot # noqa: E402
- pwb = pywikibot
+ pwb = pywikibot
def run_python_file(filename, argv, argvu, package=None):
@@ -151,17 +149,9 @@
try:
import requests
- if not hasattr(requests, '__version__'):
- print("requests import problem: requests.__version__ does not exist.")
- requests = None
except ImportError as e:
- print("ImportError: %s" % e)
- requests = None
-
-if not requests:
- raise ImportError("Python module 'requests' is required.\n"
- "Try running 'pip install requests'.")
-
+ raise ImportError("{0}\nPython module 'requests' is required.\n"
+ "Try running 'pip install requests'.".format(e))
del requests
if len(sys.argv) > 1 and sys.argv[1][0] != '-':
--
To view, visit https://gerrit.wikimedia.org/r/420241
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iadcc9174f51d7f634cfec048df61a3df8379dc14
Gerrit-Change-Number: 420241
Gerrit-PatchSet: 1
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: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>