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 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to