jenkins-bot has submitted this change and it was merged.
Change subject: Use bytes-based url (un)quote for py3k
......................................................................
Use bytes-based url (un)quote for py3k
Change-Id: I6f78e4e0ab25f47558b44e7053f6b9c7e29d3c15
---
M pywikibot/page.py
1 file changed, 6 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index e17acf2..13eba78 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -21,7 +21,10 @@
import re
import threading
import unicodedata
-import urllib
+try:
+ from urllib.parse import quote_from_bytes, unquote_to_bytes
+except ImportError:
+ from urllib import quote as quote_from_bytes, unquote as unquote_to_bytes
import collections
logger = logging.getLogger("pywiki.wiki.page")
@@ -166,7 +169,7 @@
title = title.replace(u' ', u'_')
if asUrl:
encodedTitle = title.encode(self.site.encoding())
- title = urllib.quote(encodedTitle)
+ title = quote_from_bytes(encodedTitle)
if as_filename:
# Replace characters that are not possible in file names on some
# systems.
@@ -3481,7 +3484,7 @@
for enc in encList:
try:
t = title.encode(enc)
- t = urllib.unquote(t)
+ t = unquote_to_bytes(t)
return unicode(t, enc)
except UnicodeError, ex:
if not firstException:
--
To view, visit https://gerrit.wikimedia.org/r/90754
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6f78e4e0ab25f47558b44e7053f6b9c7e29d3c15
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: python3
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Use key function instead of comparator for sorting interwikis
......................................................................
Use key function instead of comparator for sorting interwikis
Change-Id: Ic7cde6334eb9e07c2e550ef4e2c88a4ccd84f49b
---
M pywikibot/family.py
1 file changed, 1 insertion(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py
index e446471..8129aa8 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -98,13 +98,9 @@
]
# Order for fy: alphabetical by code, but y counts as i
- def fycomp(x, y):
- x = x.replace("y", "i") + x.count("y") * "!"
- y = y.replace("y", "i") + y.count("y") * "!"
- return cmp(x, y)
self.fyinterwiki = self.alphabetic[:]
self.fyinterwiki.remove('nb')
- self.fyinterwiki.sort(fycomp)
+ self.fyinterwiki.sort(key=lambda x: x.replace("y", "i") + x.count("y") * "!")
self.langs = {}
--
To view, visit https://gerrit.wikimedia.org/r/90753
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic7cde6334eb9e07c2e550ef4e2c88a4ccd84f49b
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: python3
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Xqt has submitted this change and it was merged.
Change subject: Add debugging aids for networking
......................................................................
Add debugging aids for networking
Change-Id: Iff6fccb9d12628a8fd6efff3fd2a822f324b112a
---
M pywikibot/comms/http.py
M wikipedia.py
2 files changed, 2 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 2f11b4b..3c265f4 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -129,6 +129,7 @@
except KeyboardInterrupt:
raise
except urllib2.HTTPError, e:
+ debug(u'Page %s could not be retrieved: HTTP/%i %s: %r' % (url, e.code, e.message, e.read()))
if e.code in [401, 404]:
raise PageNotFound(
u'Page %s could not be retrieved. Check your family file.'
diff --git a/wikipedia.py b/wikipedia.py
index 98da805..80fabc5 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -7029,6 +7029,7 @@
raise
except urllib2.HTTPError, e:
if e.code in [401, 404]:
+ debug(u"Got HTTP/%i %s: \n %r" % (e.code, e.message, e.read()))
raise PageNotFound(u'Page %s could not be retrieved. Check '
u'your family file ?' % url)
# just check for HTTP Status 500 (Internal Server Error)?
--
To view, visit https://gerrit.wikimedia.org/r/92075
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iff6fccb9d12628a8fd6efff3fd2a822f324b112a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Xqt has submitted this change and it was merged.
Change subject: Disable API page preloading
......................................................................
Disable API page preloading
Change-Id: I2bb9f1c23a697a197a5ef682b8ed5d6a1dbd74fb
---
M wikipedia.py
1 file changed, 2 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/wikipedia.py b/wikipedia.py
index 98da805..98b6e11 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -5504,7 +5504,7 @@
# Sometimes query does not contains revisions
# or some pages are missing. Deactivate api call and use the
# old API special:export
- if self.site.has_api() and logger.isEnabledFor(DEBUG):
+ if self.site.has_api() and False:
while True:
try:
data = self.getDataApi()
@@ -5926,8 +5926,7 @@
u'Getting %(count)d page{{PLURAL:count||s}} %(API)sfrom %(site)s...',
{'count': len(pages),
# API is deactivated since r8036 because some pages are missing
- 'API': (u'', u'via API ')[site.has_api() and
- logger.isEnabledFor(DEBUG)],
+ 'API': (u'', u'via API ')[site.has_api() and False],
'site': site}))
# default is 500/4, but It might have good point for server.
--
To view, visit https://gerrit.wikimedia.org/r/92076
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2bb9f1c23a697a197a5ef682b8ed5d6a1dbd74fb
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Correct '-debug' command-line switch behavior
......................................................................
Correct '-debug' command-line switch behavior
- The switch was always set, and
- -debug was not functional in the first place
Followup for https://mediawiki.org/wiki/Special:Code/pywikipedia/11397
Followup for I0d63aa63bd88050e938cb5fc47b2ca79e098fb0d
Change-Id: I45c8776b00e2ab2c1dd64055a9a62c4294e2db14
---
M wikipedia.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/wikipedia.py b/wikipedia.py
index e3df410..98da805 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -9581,7 +9581,7 @@
elif arg == '-debug':
if not logger:
init_handlers()
- logging.getLogger().setLevel(DEBUG)
+ logger.setLevel(DEBUG)
config.special_page_limit = 500
else:
# the argument is not global. Let the specific bot script care
@@ -9891,7 +9891,7 @@
logger = logging.getLogger('pywiki')
logger.addHandler(nh)
- logger.setLevel(DEBUG)
+ logger.setLevel(DEBUG+1)
logger.propagate = True
--
To view, visit https://gerrit.wikimedia.org/r/92068
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I45c8776b00e2ab2c1dd64055a9a62c4294e2db14
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <dr.trigon(a)surfeu.ch>
Gerrit-Reviewer: DrTrigon <dr.trigon(a)surfeu.ch>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot