py3k port helpers

This commit is contained in:
Ruud
2014-01-20 23:58:54 +01:00
parent 08e2a3a883
commit 29a34fef8c
28 changed files with 58 additions and 44 deletions
+5 -4
View File
@@ -5,6 +5,7 @@ import os
import re
import traceback
import unicodedata
import six
log = CPLog(__name__)
@@ -29,7 +30,7 @@ def toUnicode(original, *args):
return original
else:
try:
return unicode(original, *args)
return six.text_type(original, *args)
except:
try:
return ek(original, *args)
@@ -102,10 +103,10 @@ def stripAccents(s):
def tryUrlencode(s):
new = u''
new = six.u('')
if isinstance(s, dict):
for key, value in s.iteritems():
new += u'&%s=%s' % (key, tryUrlencode(value))
for key, value in s.items():
new += six.u('&%s=%s') % (key, tryUrlencode(value))
return new[1:]
else: