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, 8 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 0de6559..759093a 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -21,8 +21,13 @@ import logging import re import unicodedata -import urllib import collections + +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
logger = logging.getLogger("pywiki.wiki.page")
@@ -167,7 +172,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. @@ -3527,7 +3532,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 as ex: if not firstException:
pywikibot-commits@lists.wikimedia.org