jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Return exception instead of raising it
......................................................................
[FIX] Return exception instead of raising it
Instead of raising exceptions it should be returned so the data is set
to that exception. It also tests for that case.
It explicitly requires data after the request. One assertion is in the
thread after the lock is released and one assertion is in fetch and
happens also after the lock is released.
Bug: T94993
Change-Id: I955f1c91ae2dc31e404f05ee776d4184882c76f2
---
M pywikibot/comms/http.py
M pywikibot/comms/threadedhttp.py
M tests/http_tests.py
3 files changed, 10 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 4c2b2ec..044dba5 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -356,6 +356,7 @@
"""
request = _enqueue(uri, method, body, headers, **kwargs)
request._join() # wait for it
+ assert(request._data) # if there's no data in the answer we're in trouble
# Run the error handling callback in the callers thread so exceptions
# may be caught.
if default_error_handling:
diff --git a/pywikibot/comms/threadedhttp.py b/pywikibot/comms/threadedhttp.py
index e3c0e64..ced5329 100644
--- a/pywikibot/comms/threadedhttp.py
+++ b/pywikibot/comms/threadedhttp.py
@@ -306,7 +306,7 @@
headers=headers,
max_redirects=max_redirects - 1)
else:
- raise httplib2.RedirectLimit(
+ return httplib2.RedirectLimit(
"Redirected more times than redirection_limit allows.",
response, content)
@@ -539,6 +539,8 @@
finally:
if item.lock:
item.lock.release()
+ # if data wasn't set others might hang; but wait on lock release
+ assert(item._data)
# Metaweb Technologies, Inc. License:
diff --git a/tests/http_tests.py b/tests/http_tests.py
index ff8337c..76ff447 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -191,6 +191,12 @@
self.assertEqual(r.response_headers['content-location'],
'http://www.gandi.net')
+ def test_maximum_redirects(self):
+ """Test that maximum redirect exception doesn't hang up."""
+ self.assertRaises(httplib2.RedirectLimit,
+ http.fetch,
+ uri='http://getstatuscode.com/300')
+
class ThreadedHttpTestCase(TestCase):
--
To view, visit https://gerrit.wikimedia.org/r/201696
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I955f1c91ae2dc31e404f05ee776d4184882c76f2
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] APISite: Don't require a query for exturl
......................................................................
[IMPROV] APISite: Don't require a query for exturl
The MW API can easily return a list of all pages which use external
links without requiring a query.
Change-Id: I1668b51490d2274b3b8e7e684d5e3bebcfa5abbd
---
M pywikibot/site.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 73b6a2b..552d80c 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3609,7 +3609,7 @@
bkgen.request["bkusers"] = users
return bkgen
- def exturlusage(self, url, protocol="http", namespaces=None,
+ def exturlusage(self, url=None, protocol="http", namespaces=None,
step=None, total=None, content=False):
"""Iterate Pages that contain links to the given URL.
--
To view, visit https://gerrit.wikimedia.org/r/195640
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1668b51490d2274b3b8e7e684d5e3bebcfa5abbd
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] BasePage: Implement pageAPInfo from compat
......................................................................
[FIX] BasePage: Implement pageAPInfo from compat
Bug: T95306
Change-Id: Id07d545ba8d2d1d2a95ddc835d825000d134c959
---
M pywikibot/page.py
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 25b0892..6ff6d3a 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -427,6 +427,11 @@
"""Return the current revision id for this page."""
return self.latest_revision_id
+ @deprecated('latest_revision_id')
+ def pageAPInfo(self):
+ """Return the current revision id for this page."""
+ return self.latest_revision_id
+
@property
def latest_revision(self):
"""Return the current revision for this page."""
--
To view, visit https://gerrit.wikimedia.org/r/202428
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id07d545ba8d2d1d2a95ddc835d825000d134c959
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(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 <>