From 48e05e4b7fdb0f4262141825f3a3e1ba29acd5d9 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 2 Jun 2011 11:36:30 -0400 Subject: [PATCH] cc-2055: switch-to-init.d -return proper return value when exception is raised in recorder.py --- python_apps/api_clients/api_client.py | 1 + python_apps/show-recorder/recorder.py | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 95fdd3d4c..84e1a4d43 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -318,6 +318,7 @@ class AirTimeApiClient(ApiClientInterface): except Exception, e: logger.error("Exception: %s", e) + response = None return response diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py index 783ad81e6..a6352729a 100644 --- a/python_apps/show-recorder/recorder.py +++ b/python_apps/show-recorder/recorder.py @@ -166,21 +166,18 @@ class Record(): def get_shows(self): - shows = self.api_client.get_shows_to_record() - - if self.sr is not None: - if not shows['is_recording'] and self.sr.is_recording(): - self.sr.cancel_recording() - - - if shows is not None: - shows = shows[u'shows'] - else: - shows = [] + response = self.api_client.get_shows_to_record() - if len(shows): - self.process_shows(shows) - self.check_record() + if response is not None and 'is_recording' in response: + if self.sr is not None: + if not response['is_recording'] and self.sr.is_recording(): + self.sr.cancel_recording() + + shows = response[u'shows'] + + if len(shows): + self.process_shows(shows) + self.check_record() if __name__ == '__main__':