diff options
author | Daniel Drake <dsd@laptop.org> | 2010-07-12 19:04:43 (GMT) |
---|---|---|
committer | Daniel Drake <dsd@laptop.org> | 2010-07-12 19:04:43 (GMT) |
commit | 90f5c6054a8bb5eda88cb3ec7733677526ad60f2 (patch) | |
tree | a4f79b8dbf6cc6435cfd309c73f8f102801c10d7 /activity.py | |
parent | 98e9b2b74a87990449f3da4d15ae3815b394259b (diff) |
Don't choke on OHM dbus errors
These shouldn't affect usability of the activity.
Diffstat (limited to 'activity.py')
-rw-r--r-- | activity.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/activity.py b/activity.py index e04654c..055d074 100644 --- a/activity.py +++ b/activity.py @@ -200,8 +200,12 @@ class AcousticMeasureActivity(Activity): return True if self.ohm_keystore is not None: - self.ohm_keystore.SetKey('suspend.inhibit', 1) - return self.ohm_keystore.GetKey('suspend.inhibit') + try: + self.ohm_keystore.SetKey('suspend.inhibit', 1) + return self.ohm_keystore.GetKey('suspend.inhibit') + except dbus.exceptions.DBusException: + self._logger.debug("failed to inhibit suspend") + return False else: return False @@ -212,8 +216,12 @@ class AcousticMeasureActivity(Activity): return True if self.ohm_keystore is not None: - self.ohm_keystore.SetKey('suspend.inhibit', 0) - return self.ohm_keystore.GetKey('suspend.inhibit') + try: + self.ohm_keystore.SetKey('suspend.inhibit', 0) + return self.ohm_keystore.GetKey('suspend.inhibit') + except dbus.exceptions.DBusException: + self._logger.debug("failed to allow suspend") + return False else: return False |