CC-2633: moving to_unicode() to api_client.py

- move to_unicode() to api_client.py
- fixed how it decodes path in airtime-import.py
This commit is contained in:
James 2011-08-05 12:35:50 -04:00
parent e2a5344e6e
commit 375cfb2c2d
4 changed files with 34 additions and 26 deletions

View file

@ -32,7 +32,13 @@ def api_client_factory(config):
else:
logger.info('API Client "'+config["api_client"]+'" not supported. Please check your config file.\n')
sys.exit()
def to_unicode(obj, encoding='utf-8'):
if isinstance(obj, basestring):
if not isinstance(obj, unicode):
obj = unicode(obj, encoding)
return obj
class ApiClientInterface:
# Implementation: optional
@ -515,7 +521,6 @@ class AirTimeApiClient(ApiClientInterface):
return response
################################################################################
# OpenBroadcast API Client
################################################################################