diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-02-16 04:20:49 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-02-16 04:20:49 (GMT) |
commit | 3635ae42e9e47208542b3f95ac1bfb79a6707339 (patch) | |
tree | ebeb3dc272b53c54b54248e9cbb86b05ba19fd8f | |
parent | 0510cde0adbf6dca69060fdccec83ee227c57a8f (diff) |
catch exception when importing telepathyclient
-rw-r--r-- | collaboration/telepathyclient.py | 17 | ||||
-rw-r--r-- | extra/collaborationplugin.py | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/collaboration/telepathyclient.py b/collaboration/telepathyclient.py index 5491530..f3e8578 100644 --- a/collaboration/telepathyclient.py +++ b/collaboration/telepathyclient.py @@ -18,11 +18,15 @@ import logging import dbus from dbus import PROPERTIES_IFACE -from telepathy.interfaces import CLIENT, \ - CLIENT_APPROVER, \ - CLIENT_HANDLER, \ - CLIENT_INTERFACE_REQUESTS -from telepathy.server import DBusProperties +try: + from telepathy.interfaces import CLIENT, \ + CLIENT_APPROVER, \ + CLIENT_HANDLER, \ + CLIENT_INTERFACE_REQUESTS + from telepathy.server import DBusProperties + TELEPATHY_AVAILABLE = True +except ImportError: + TELEPATHY_AVAILABLE = False import dispatch @@ -34,7 +38,10 @@ _instance = None class TelepathyClient(dbus.service.Object, DBusProperties): + def __init__(self): + if not TELEPATHY_AVAILABLE: + return None self._interfaces = set([CLIENT, CLIENT_HANDLER, CLIENT_INTERFACE_REQUESTS, PROPERTIES_IFACE, CLIENT_APPROVER]) diff --git a/extra/collaborationplugin.py b/extra/collaborationplugin.py index a910991..b07d892 100644 --- a/extra/collaborationplugin.py +++ b/extra/collaborationplugin.py @@ -169,6 +169,8 @@ class CollaborationPlugin(Plugin): dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) self._client_handler = telepathyclient.get_instance() + if self._client_handler == None: + raise RuntimeError('Telepathy client unavailable') self._neighborhood = get_neighborhood(params) self._neighborhood.connect('activity-added', self._activity_added_cb) self._neighborhood.connect('activity-removed', |