jenkins-bot has submitted this change and it was merged.
Change subject: textlib_tests.py: restore value before self.assert
......................................................................
textlib_tests.py: restore value before self.assert
If assert statement raises an error, the correct value is not resored.
Move restoring of value before self.assert statement.
Change-Id: Iffea89f8910bd05001e2b1480ce89b491276a632
---
M tests/textlib_tests.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py
index 49d5e5f..cafa378 100644
--- a/tests/textlib_tests.py
+++ b/tests/textlib_tests.py
@@ -172,8 +172,9 @@
sep = config.LS
config.line_separator = '' # use an empty separator temporarily
new = textlib.replaceCategoryLinks(old, cats, site=self.site)
+ # restore the default separator
+ config.line_separator = sep
self.assertEqual(old, new)
- config.line_separator = sep # restore the default separator
class TestTemplatesInCategory(TestCase):
--
To view, visit https://gerrit.wikimedia.org/r/164878
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iffea89f8910bd05001e2b1480ce89b491276a632
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Bug 71538 - Pages might not be returned at first req.submit()
......................................................................
Bug 71538 - Pages might not be returned at first req.submit()
Query.Generator returns if self.resultkey is not found in the first
batch of retrieved data.
If "query-continue" is present, valid data might be returned later, so
the query must continue.
Change-Id: I5aa1979d5c7f5c7da74686d91162ecad669a83cf
---
M pywikibot/data/api.py
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index ea68c39..63e47cb 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -962,8 +962,11 @@
if self.limit and self.limit > 0 and count >= self.limit:
return
else:
- # No results.
- return
+ # if query-continue is present, self.resultkey might not have been
+ # fetched yet
+ if "query-continue" not in self.data:
+ # No results.
+ return
if self.module == "random" and self.limit:
# "random" module does not return "query-continue"
# now we loop for a new random query
--
To view, visit https://gerrit.wikimedia.org/r/164258
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5aa1979d5c7f5c7da74686d91162ecad669a83cf
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
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: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPROV] Use str.decode instead of unicode
......................................................................
[IMPROV] Use str.decode instead of unicode
With Python 3 unicode was removed. To support both versions 'unicode' is
aliased as 'str' in Python 3. But the usage of 'unicode(str, enc)' is
not necessary and instead 'str.decode(enc)' can be used (or to be exact
it's 'bytes' instead of 'str' in Python 3). Unfortunately this does not
remove the need for the 'unicode' alias, but reduces it a bit.
Change-Id: I7118142b7881821d78e4cb848116c4a2e5721c0a
---
M pywikibot/bot.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
3 files changed, 5 insertions(+), 5 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 941f4b0..12a64fe 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -378,7 +378,7 @@
'newline': ("\n" if newline else "")}
if decoder:
- text = unicode(text, decoder)
+ text = text.decode(decoder)
elif not isinstance(text, unicode):
if not isinstance(text, str):
# looks like text is a non-text object.
@@ -387,9 +387,9 @@
text = unicode(text)
else:
try:
- text = unicode(text, 'utf-8')
+ text = text.decode('utf-8')
except UnicodeDecodeError:
- text = unicode(text, 'iso8859-1')
+ text = text.decode('iso8859-1')
logger.log(_level, text, extra=context, **kwargs)
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 70f8dd1..fa3158d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4510,7 +4510,7 @@
try:
t = title.encode(enc)
t = unquote_to_bytes(t)
- return unicode(t, enc)
+ return t.decode(enc)
except UnicodeError as ex:
if not firstException:
firstException = ex
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index c30c7ca..a57a22a 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -1483,7 +1483,7 @@
break
if pageName:
namespace = site.namespace(namespaceNumber)
- pageName = unicode(pageName, site.encoding())
+ pageName = pageName.decode(site.encoding())
if namespace:
pageTitle = '%s:%s' % (namespace, pageName)
else:
--
To view, visit https://gerrit.wikimedia.org/r/162563
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7118142b7881821d78e4cb848116c4a2e5721c0a
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: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>