jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Fix purgepages() result
......................................................................
[bugfix] Fix purgepages() result
linkupdates are only done if the value of the key argument is True or None.
Check for the value first.
Test added.
Bug: T151712
Change-Id: I9367ddf02c782694947c1f452a515cea8971819f
---
M pywikibot/site.py
M tests/page_tests.py
2 files changed, 2 insertions(+), 4 deletions(-)
Approvals:
Magul: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 4e8b6e1..cd6b1d4 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -5754,20 +5754,17 @@
"""
req = self._simple_request(action='purge',
titles=[page for page in set(pages)])
- linkupdate = False
linkupdate_args = ['forcelinkupdate', 'forcerecursivelinkupdate']
for arg in kwargs:
if arg in linkupdate_args + ['redirects', 'converttitles']:
req[arg] = kwargs[arg]
- if arg in linkupdate_args:
- linkupdate = True
result = req.submit()
if 'purge' not in result:
pywikibot.error(u'purgepages: Unexpected API response:\n%s' % result)
return False
result = result['purge']
purged = ['purged' in page for page in result]
- if linkupdate:
+ if any(kwargs.get(arg) for arg in linkupdate_args):
purged += ['linkupdate' in page for page in result]
return all(purged)
diff --git a/tests/page_tests.py b/tests/page_tests.py
index ea2d7da..ebb9a38 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -844,6 +844,7 @@
"""Test purging the mainpage."""
mainpage = self.get_mainpage()
self.assertIsInstance(mainpage.purge(), bool)
+ self.assertEqual(mainpage.purge(), mainpage.purge(forcelinkupdate=None))
def test_watch(self):
"""Test Page.watch, with and without unwatch enabled."""
--
To view, visit https://gerrit.wikimedia.org/r/323686
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9367ddf02c782694947c1f452a515cea8971819f
Gerrit-PatchSet: 2
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: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Decommission compat
......................................................................
Decommission compat
- update CONTENTS file and add a deprecation warning
- update copyright not in LICENSE file
- provide a user warning for decommission compat but only show it once.
The throttle.ctl is used by all scripts. Use it to remember whether
a deprecation warning is already shown to the operator.
Bug: T99365
Bug: T101214
Change-Id: I395c3560e954ccef183636b5c0b0d4e8288bc6ab
---
M CONTENTS
M LICENSE
M pywikibot/throttle.py
3 files changed, 62 insertions(+), 12 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/CONTENTS b/CONTENTS
index ff60416..5a15700 100644
--- a/CONTENTS
+++ b/CONTENTS
@@ -2,14 +2,29 @@
example robots are included.
=======================================================================
+PLEASE NOTE: This pywikibot branch is deprecated. You may use it but no
+bug fixes, features or support is provided by the pywikibot developer
+team anymore. This package only runs for MediaWiki versions not higher
+than 1.27. Python version 2.7.2 or higher is needed but Python 3.X is
+not supported.
+
+Please use the new core branch of the pywikibot framework which supports
+MediaWiki version 1.14 upto the current version and Python release 2.7.2
+and higher as well as 3.3 and higher. Compat scripts are already migrated
+to core branch and there is a migrating tool which helps converting of
+your private scripts.
+
+To get started on proper usage of the new bot framework, please refer to:
+
+ http://www.mediawiki.org/wiki/Manual:Pywikibot
+
+=======================================================================
+
+-----------------------------------------------------------------------
PLEASE DO NOT PLAY WITH THIS PACKAGE. These programs can actually
modify the live wiki on the net, and proper wiki-etiquette should
be followed before running it on any wiki.
-=======================================================================
-
-To get started on proper usage of the bot framework, please refer to:
-
- http://www.mediawiki.org/wiki/Manual:Pywikibot
+-----------------------------------------------------------------------
The contents of the package are:
@@ -311,10 +326,7 @@
You need to have at least python version 2.7.2 (http://www.python.org/download/)
or newer installed on your computer to be able to run any of the code in this
-package, but not 3.x, because pywikibot is still not updated to it! Support
-for older versions of python is not planned. Some scripts could run with older
-python releases. Please refer the manual at mediawiki for further details and
-restrictions.
+package, but not 3.x. Support for other versions of python is not planned.
You do not need to "install" this package to be able to make use of
it. You can actually just run it from the directory where you unpacked
diff --git a/LICENSE b/LICENSE
index 724e5a4..3ca9422 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2015 Pywikibot team
+Copyright (c) 2004-2016 Pywikibot team
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 08b1383..c72762a 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -1,9 +1,9 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
"""
Mechanics to slow down wiki read and/or write rate.
"""
#
-# (C) Pywikipedia bot team, 2008
+# (C) Pywikipedia bot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
@@ -33,6 +33,9 @@
access.
"""
+
+ message = 'Compat deprecation warning shown\n'
+
def __init__(self, mindelay=None, maxdelay=None, writedelay=None,
multiplydelay=True, verbosedelay=False, write=False):
self.lock = threading.RLock()
@@ -64,9 +67,31 @@
self.setDelay()
self.write = write
+ def _show_warning(self):
+ """Show compat deprecation waring once."""
+ pywikibot.input("""\03{lightyellow}
+PLEASE NOTE: compat pywikibot branch is deprecated. You may use it but no
+bug fixes, features or support is provided by the pywikibot developer
+team anymore.
+
+This package only runs for MediaWiki versions not higher than 1.27.
+
+Please use the new core branch of the pywikibot framework which supports
+the current version of MediaWiki. Compat scripts are already migrated
+to core branch and there is a migrating tool which helps converting of
+your private scripts.
+
+Please refer to:
+ http://www.mediawiki.org/wiki/Manual:Pywikibot
+ https://phabricator.wikimedia.org/T99365
+
+Press <enter> to continue.
+\03{default}""")
+
def checkMultiplicity(self):
"""Count running processes for site and set process_multiplicity."""
global pid
+ warning = True
self.lock.acquire()
mysite = self.mysite = str(pywikibot.getSite())
if pywikibot.verbose:
@@ -86,6 +111,9 @@
else:
now = time.time()
for line in f.readlines():
+ if line == self.message:
+ warning = False
+ continue
# parse line; format is "pid timestamp site"
try:
line = line.split(' ')
@@ -108,6 +136,9 @@
if not pid and this_pid >= my_pid:
my_pid = this_pid+1 # next unused process id
+ if warning:
+ self._show_warning()
+
if not pid:
pid = my_pid
self.checktime = time.time()
@@ -117,6 +148,7 @@
processes.sort(key=lambda p:(p['pid'], p['site']))
try:
f = open(self.ctrlfilename, 'w')
+ f.write(self.message)
for p in processes:
f.write("%(pid)s %(time)s %(site)s\n" % p)
except IOError:
@@ -193,6 +225,7 @@
# drop all throttles with this process's pid, regardless of site
self.checktime = 0
processes = []
+ warning = False
try:
f = open(self.ctrlfilename, 'r')
except IOError:
@@ -201,6 +234,9 @@
now = time.time()
for line in f.readlines():
try:
+ if line == self.message:
+ warning = True
+ continue
line = line.split(' ')
this_pid = int(line[0])
ptime = int(line[1].split('.')[0])
@@ -216,6 +252,8 @@
processes.sort(key=lambda p:p['pid'])
try:
f = open(self.ctrlfilename, 'w')
+ if warning:
+ f.write(self.message)
for p in processes:
f.write("%(pid)s %(time)s %(site)s\n" % p)
except IOError:
--
To view, visit https://gerrit.wikimedia.org/r/322502
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I395c3560e954ccef183636b5c0b0d4e8288bc6ab
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Andre Engels <andreengels(a)gmail.com>
Gerrit-Reviewer: BinĂ¡ris2 <wikiposta+wikitech(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <Ladsgroup(a)gmail.com>
Gerrit-Reviewer: Luke081515 <luke081515(a)web.de>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Close connection after every request in test_https_cert_error.
......................................................................
Close connection after every request in test_https_cert_error.
Hanging connection create unexpected warning during another request to the
same host.
Bug: T151248
Change-Id: I5c2d2b4461eba04df3f4b41a0862b574d404af82
---
M tests/http_tests.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/http_tests.py b/tests/http_tests.py
index ea1b3cb..35d705f 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -131,6 +131,7 @@
self.assertRaises(pywikibot.FatalServerError,
http.fetch,
uri='https://testssl-expire-r2i2.disig.sk/index.en.html')
+ http.session.close() # clear the connection
with warnings.catch_warnings(record=True) as warning_log:
response = http.fetch(
@@ -139,12 +140,13 @@
r = response.content
self.assertIsInstance(r, unicode)
self.assertTrue(re.search(r'<title>.*</title>', r))
+ http.session.close() # clear the connection
# Verify that it now fails again
- http.session.close() # but first clear the connection
self.assertRaises(pywikibot.FatalServerError,
http.fetch,
uri='https://testssl-expire-r2i2.disig.sk/index.en.html')
+ http.session.close() # clear the connection
# Verify that the warning occurred
self.assertEqual(len(warning_log), 1)
--
To view, visit https://gerrit.wikimedia.org/r/322866
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5c2d2b4461eba04df3f4b41a0862b574d404af82
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <lokal.profil(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.
Change subject: pagegenerators.py: use explicit list instead of map()
......................................................................
pagegenerators.py: use explicit list instead of map()
In python3 map() will create a <map object>, which will be emptied after
first use. Second comparison will throw an error.
Use explicitly a list instead.
Bug: T151237
Change-Id: I1ff53a90e2e3c06e079a82387ae186fc8f3215e0
---
M pywikibot/pagegenerators.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Magul: Looks good to me, but someone else must approve
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index d4677e7..748d09d 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -849,7 +849,7 @@
if not self.site.has_extension('ProofreadPage'):
raise UnknownExtension(
'Ql filtering needs a site with ProofreadPage extension.')
- value = map(int, value.split(','))
+ value = [int(_) for _ in value.split(',')]
if min(value) < 0 or max(value) > 4: # Invalid input ql.
valid_ql = ['{0}: {1}'.format(*i) for
i in self.site.proofread_levels.items()]
--
To view, visit https://gerrit.wikimedia.org/r/322415
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1ff53a90e2e3c06e079a82387ae186fc8f3215e0
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>