mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Remaining Python 3 compatibility changes
Summary: Biggest change is turning everything to unicode Test Plan: The tests Reviewers: dsagal, paulfitz Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2875
This commit is contained in:
16
sandbox/grist/urllib_patch.py
Normal file
16
sandbox/grist/urllib_patch.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import urllib
|
||||
|
||||
import six
|
||||
from six.moves import urllib_parse
|
||||
|
||||
original_quote = urllib_parse.quote
|
||||
|
||||
def patched_quote(s, safe='/'):
|
||||
if isinstance(s, six.text_type):
|
||||
s = s.encode('utf8')
|
||||
result = original_quote(s, safe=safe)
|
||||
if isinstance(result, six.binary_type):
|
||||
result = result.decode('utf8')
|
||||
return result
|
||||
|
||||
urllib.quote = patched_quote
|
||||
Reference in New Issue
Block a user