Skip to content

Commit 654875f

Browse files
committed
add unicode urlquote workaround for Python 2
1 parent 2d4f3c4 commit 654875f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

atwiki/uri.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
except:
1010
# Python 2
1111
import urlparse
12-
from urllib import quote as urlquote
12+
def urlquote(s, safe=b'/'):
13+
import urllib
14+
if isinstance(s, unicode):
15+
s = s.encode('utf-8')
16+
return urllib.quote(s, safe)
1317

1418
import os.path
1519
import warnings

0 commit comments

Comments
 (0)