jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463984 )
Change subject: [fix] Fix typo in login.py script
......................................................................
[fix] Fix typo in login.py script
Word should be "current" and not "curren".
Change-Id: I170d0693d733abcd8dbb635fc8f2bc54e0648132
---
M scripts/login.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/login.py b/scripts/login.py
index 161f17f..eb277cf 100755
--- a/scripts/login.py
+++ b/scripts/login.py
@@ -16,7 +16,7 @@
-all Try to log in on all sites where a username is defined in
user-config.py.
- -logout Log out of the curren site. Combine with -all to log out of
+ -logout Log out of the current site. Combine with -all to log out of
all sites, or with -family and -lang to log out of a specific
site.
--
To view, visit https://gerrit.wikimedia.org/r/463984
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I170d0693d733abcd8dbb635fc8f2bc54e0648132
Gerrit-Change-Number: 463984
Gerrit-PatchSet: 2
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463954 )
Change subject: [cleanup] cleanup docs/conf.py
......................................................................
[cleanup] cleanup docs/conf.py
- remove preleading "u" from strings
- make sure lines do not exceed 79 chars
Bug: T89589
Change-Id: I6f80256592df6281b5e267d4980bd864049bb771
---
M docs/conf.py
1 file changed, 17 insertions(+), 15 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index c78193d..079af53 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -30,13 +30,13 @@
sys.path.insert(0, repo_dir)
os.chdir(repo_dir)
-# -- General configuration -----------------------------------------------------
+# -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx_epytext',
'sphinx.ext.todo',
@@ -87,7 +87,8 @@
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
-# The reST default role (used for this markup: `text`) to use for all documents.
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
default_role = 'code'
# If true, '()' will be appended to :func: etc. cross-reference text.
@@ -108,7 +109,7 @@
# modindex_common_prefix = []
-# -- Options for HTML output ---------------------------------------------------
+# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
@@ -188,15 +189,16 @@
htmlhelp_basename = 'Pywikibotdoc'
-# -- Options for LaTeX output --------------------------------------------------
+# -- Options for LaTeX output -------------------------------------------------
latex_elements = {}
# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
+# (source start file, target name, title, author, documentclass
+# [howto/manual]).
latex_documents = [
- ('index', 'Pywikibot.tex', u'Pywikibot Documentation',
- u'Pywikibot team', 'manual'),
+ ('index', 'Pywikibot.tex', 'Pywikibot Documentation',
+ 'Pywikibot team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -220,27 +222,27 @@
# latex_domain_indices = True
-# -- Options for manual page output --------------------------------------------
+# -- Options for manual page output -------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'pywikibot', u'Pywikibot Documentation',
- [u'Pywikibot team'], 1)
+ ('index', 'pywikibot', 'Pywikibot Documentation',
+ ['Pywikibot team'], 1)
]
# If true, show URL addresses after external links.
# man_show_urls = False
-# -- Options for Texinfo output ------------------------------------------------
+# -- Options for Texinfo output -----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'Pywikibot', u'Pywikibot Documentation',
- u'Pywikibot team', 'Pywikibot', 'One line description of project.',
+ ('index', 'Pywikibot', 'Pywikibot Documentation',
+ 'Pywikibot team', 'Pywikibot', 'One line description of project.',
'Miscellaneous'),
]
--
To view, visit https://gerrit.wikimedia.org/r/463954
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6f80256592df6281b5e267d4980bd864049bb771
Gerrit-Change-Number: 463954
Gerrit-PatchSet: 1
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463599 )
Change subject: scripts/imagecopy.py: Do not create Uploadbot.localskips.txt on loading
......................................................................
scripts/imagecopy.py: Do not create Uploadbot.localskips.txt on loading
Only create the file if the module is being run as the main module.
Bug: T205772
Change-Id: Ifd8be27b5f2a213c94b1db96ede7fa48ade8fbd6
---
M scripts/imagecopy.py
1 file changed, 9 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 21f78ec..4e8f70f 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -372,12 +372,13 @@
return pageText
-# -label ok skip view
-# textarea
-archivo = config.datafilepath('Uploadbot.localskips.txt')
-if not path.exists(archivo):
- with open(archivo, 'w') as tocreate:
- tocreate.write('{{NowCommons')
+def load_global_archivo():
+ """Load/create Uploadbot.localskips.txt and save the path in `archivo`."""
+ global archivo
+ archivo = config.datafilepath('Uploadbot.localskips.txt')
+ if not path.exists(archivo):
+ with open(archivo, 'w') as tocreate:
+ tocreate.write('{{NowCommons')
def getautoskip():
@@ -495,7 +496,6 @@
def main(*args):
"""Process command line arguments and invoke bot."""
- imagepage = None
always = False
category = ''
delete_after_done = False
@@ -518,6 +518,8 @@
pywikibot.bot.suggest_help(missing_generator=True)
return False
+ load_global_archivo()
+
for page in pregenerator:
skip = False
if page.exists() and page.namespace() == 6 \
--
To view, visit https://gerrit.wikimedia.org/r/463599
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd8be27b5f2a213c94b1db96ede7fa48ade8fbd6
Gerrit-Change-Number: 463599
Gerrit-PatchSet: 4
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463792 )
Change subject: [tests] Give a hint which page is failing in tests_protectedpages_create
......................................................................
[tests] Give a hint which page is failing in tests_protectedpages_create
Bug: T205883
Change-Id: I45d2a2154be7d96235e9addf16d28dae76cc15d8
---
M tests/site_tests.py
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 3fe987e..dc62322 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1034,7 +1034,10 @@
pages = list(self.get_site().protectedpages(type='create', total=10))
for page in pages:
- self.assertFalse(page.exists())
+ self.assertFalse(
+ page.exists(),
+ '\n{page} does unexpectedly exit on site {page.site}'
+ .format(page=page))
self.assertLessEqual(len(pages), 10)
def test_protectedpages_edit(self):
--
To view, visit https://gerrit.wikimedia.org/r/463792
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I45d2a2154be7d96235e9addf16d28dae76cc15d8
Gerrit-Change-Number: 463792
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463720 )
Change subject: [cleanup] cleanup exceptions.py & login.py in pywikibot/
......................................................................
[cleanup] cleanup exceptions.py & login.py in pywikibot/
- remove preleading harmless "u" from comments
- remove some very old commented out code
Change-Id: I3d6dff28e7105eefe5f326165a18cab09998b4d6
---
M pywikibot/exceptions.py
M pywikibot/login.py
2 files changed, 1 insertion(+), 13 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 98e4fd5..92a0a2e 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -143,7 +143,7 @@
# Preformatted UNICODE message where the page title will be inserted
# Override this in subclasses.
- # u"Oh noes! Page %s is too funky, we should not delete it ;("
+ # 'Oh noes! Page %s is too funky, we should not delete it ;('
message = None
def __init__(self, page, message=None):
diff --git a/pywikibot/login.py b/pywikibot/login.py
index a17c230..0f54a60 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -335,18 +335,6 @@
return False
self.storecookiedata(cookiedata)
pywikibot.log('Should be logged in now')
-# # Show a warning according to the local bot policy
-# FIXME: disabled due to recursion; need to move this to the Site object
-# after login
-# if not self.botAllowed():
-# logger.error(
-# u"Username '%(name)s' is not listed on [[%(page)s]]."
-# % {'name': self.username,
-# 'page': botList[self.site.family.name][self.site.code]})
-# logger.error(
-# "Please make sure you are allowed to use the robot before actually using it!"
-# )
-# return False
return True
def showCaptchaWindow(self, url):
--
To view, visit https://gerrit.wikimedia.org/r/463720
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3d6dff28e7105eefe5f326165a18cab09998b4d6
Gerrit-Change-Number: 463720
Gerrit-PatchSet: 3
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/463660 )
Change subject: [compat2core] Fix regressions of multiple Page methods
......................................................................
[compat2core] Fix regressions of multiple Page methods
The following methods' behavior differs between compat and core:
- templates()
- templatesWithParams()
- linkedPages()
Warnings were added to README-conversion.txt and compat2core.py. Every
incorrect (not-working compat-like) usage across scripts was fixed.
Solve_disambiguation.py slicing problem was splitted into a separate patch.
Bug: T58188
Bug: T186394
Change-Id: If0abe8ad1653e2bc0786cf48dea214d5b94d1cbc
---
M README-conversion.txt
M scripts/commonscat.py
M scripts/imagecopy_self.py
M scripts/imagerecat.py
M scripts/maintenance/compat2core.py
M scripts/solve_disambiguation.py
6 files changed, 29 insertions(+), 14 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index 4363efa..9618a07 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -91,9 +91,13 @@
The following methods have had their outputs changed:
- getVersionHistory(): Returns a pywikibot.Timestamp object instead of a MediaWiki one
+- templates(): Returns a list of Page objects of templates. In compat we have
+ a list of template title strings.
- 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.
+- linkedPages(): Returns a PageGenerator of Page objects of link targets.
+ In compat we have a list of link target strings.
=== FilePage objects ===
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 8b4062a..38c3a76 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -488,7 +488,8 @@
pywikibot.log('getCommonscat: The category is a redirect')
return self.checkCommonscatLink(
commonsPage.getRedirectTarget().title(with_ns=False))
- elif 'Category redirect' in commonsPage.templates():
+ elif (pywikibot.Page(commonsPage.site,
+ 'Template:Category redirect') in commonsPage.templates()):
pywikibot.log(
'getCommonscat: The category is a category redirect')
for template in commonsPage.templatesWithParams():
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index 4730d16..3718367 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -384,10 +384,11 @@
"""
for template in imagepage.templates():
- if template in skipTemplates[imagepage.site.lang]:
+ template_title = template.title(with_ns=False)
+ if template_title in skipTemplates[imagepage.site.lang]:
pywikibot.output(
'Found {} which is on the template skip list'
- .format(template))
+ .format(template_title))
return True
return False
diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index 8af4a9a..cdc9c57 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -86,7 +86,9 @@
imagepage = pywikibot.FilePage(page.site, page.title())
pywikibot.output('Working on ' + imagepage.title())
- if onlyUncat and not('Uncategorized' in imagepage.templates()):
+ if (onlyUncat and not pywikibot.Page(
+ imagepage.site, 'Template:Uncategorized')
+ in imagepage.templates()):
pywikibot.output('No Uncategorized template found')
else:
currentCats = getCurrentCats(imagepage)
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index 4caf605..c4b64ce 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -117,12 +117,17 @@
'by a direct site request'),
('.verbose',
'verbose_output need "from pywikibot import config" first'),
+ ('templates(',
+ 'returns a list of templage page objects, not a list of template titles.'
+ '\nPlease refer README-conversion.txt and the documentation.'),
('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.'),
- ('templates(',
- 'returns a list of template title not a list of templage page objects.'),
+ ('linkedPages(',
+ 'returns a PageGenerator of page objects of link targets, not a list\n'
+ 'of link target strings. Please refer README-conversion.txt\n'
+ 'and the documentation.'),
)
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index a262d54..378e921 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -1039,15 +1039,17 @@
"""
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()):
+ primary = i18n.translate(disambPage.site,
+ self.primary_redir_template)
+ if primary:
+ primary_page = pywikibot.Page(disambPage.site,
+ 'Template:' + primary)
+ if primary and primary_page in disambPage.templates():
baseTerm = disambPage.title()
- for template in disambPage.templatesWithParams():
- if template[0] == self.primary_redir_template[
- disambPage.site.lang] \
- and len(template[1]) > 0:
- baseTerm = template[1][1]
+ for template, params in disambPage.templatesWithParams():
+ if params and template == primary_page:
+ baseTerm = params[1]
+ break
disambTitle = primary_topic_format[self.mylang] % baseTerm
try:
disambPage2 = pywikibot.Page(
--
To view, visit https://gerrit.wikimedia.org/r/463660
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If0abe8ad1653e2bc0786cf48dea214d5b94d1cbc
Gerrit-Change-Number: 463660
Gerrit-PatchSet: 5
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Liuxinyu970226 <541329866(a)qq.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)