CC-2633: added new encode_to()
- added encode_to() to api_client - replaced .encode() with new encode_to()
This commit is contained in:
parent
a199585cb9
commit
8995e828ff
10 changed files with 54 additions and 33 deletions
|
@ -38,7 +38,13 @@ def to_unicode(obj, encoding='utf-8'):
|
|||
if not isinstance(obj, unicode):
|
||||
obj = unicode(obj, encoding)
|
||||
return obj
|
||||
|
||||
|
||||
def encode_to(obj, encoding='utf-8'):
|
||||
if isinstance(obj, basestring):
|
||||
if not isinstance(obj, str):
|
||||
obj = obj.encode(encoding)
|
||||
return obj
|
||||
|
||||
class ApiClientInterface:
|
||||
|
||||
# Implementation: optional
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue