CC-4092: Not checking for return type "None" on some function calls in media-monitor

-more fixes
This commit is contained in:
Martin Konecny 2012-07-11 17:09:17 -04:00
parent ba5a749073
commit fc1b69e1d1
2 changed files with 6 additions and 7 deletions

View file

@ -456,8 +456,8 @@ class AirTimeApiClient(ApiClientInterface):
logger.error("Exception: %s", e) logger.error("Exception: %s", e)
try: try:
return getattr(response, "files") return response["files"]
except AttributeError: except KeyError:
self.logger.error("Could not find index 'files' in dictionary: %s", str(response)) self.logger.error("Could not find index 'files' in dictionary: %s", str(response))
return [] return []

View file

@ -69,13 +69,12 @@ class AirtimeMediaMonitorBootstrap():
json = self.api_client.list_all_watched_dirs() json = self.api_client.list_all_watched_dirs()
try: try:
dirs = getattr(json, "dirs") return json["dirs"]
except AttributeError: except KeyError as e:
self.logger.error("Could not find index 'dirs' in dictionary: %s", str(dirs)) self.logger.error("Could not find index 'dirs' in dictionary: %s", str(json))
self.logger.error(e)
return {} return {}
return dirs
""" """
This function takes in a path name provided by the database (and its corresponding row id) This function takes in a path name provided by the database (and its corresponding row id)
and reads the list of files in the local file system. Its purpose is to discover which files and reads the list of files in the local file system. Its purpose is to discover which files