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:
pywikibot-commits@lists.wikimedia.org