CC-2633: added new encode_to()

- added encode_to() to api_client
- replaced .encode() with new encode_to()
This commit is contained in:
James 2011-08-05 14:40:03 -04:00
parent a199585cb9
commit 8995e828ff
10 changed files with 54 additions and 33 deletions

View file

@ -11,6 +11,7 @@ import pyinotify
from pyinotify import Notifier
#from api_clients import api_client
from api_clients import api_client
from airtimemetadata import AirtimeMetadata
class AirtimeNotifier(Notifier):
@ -74,7 +75,7 @@ class AirtimeNotifier(Notifier):
self.watch_directory(m['directory'])
elif m['event_type'] == "remove_watch":
watched_directory = m['directory'].encode('utf-8')
watched_directory = api_client.encode_to(m['directory'], 'utf-8')
mm = self.proc_fun()
wd = mm.wm.get_wd(watched_directory)
@ -83,8 +84,8 @@ class AirtimeNotifier(Notifier):
elif m['event_type'] == "change_stor":
storage_directory = self.config.storage_directory
new_storage_directory = m['directory'].encode('utf-8')
new_storage_directory_id = str(m['dir_id']).encode('utf-8')
new_storage_directory = api_client.encode_to(m['directory'], 'utf-8')
new_storage_directory_id = api_client.encode_to(str(m['dir_id']), 'utf-8')
mm = self.proc_fun()
@ -108,7 +109,7 @@ class AirtimeNotifier(Notifier):
self.watch_directory(new_storage_directory)
elif m['event_type'] == "file_delete":
filepath = m['filepath'].encode('utf-8')
filepath = api_client.encode_to(m['filepath'], 'utf-8')
mm = self.proc_fun()
self.logger.info("Adding file to ignore: %s ", filepath)