Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/activity/activityfactory.py
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-09-27 18:49:54 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-09-27 18:57:44 (GMT)
commitd60cc6ae3995063480ce412b307f578a3d1e72cc (patch)
tree7afcb313ff81c2932b675a04af1bdc5a77ea3831 /sugar/activity/activityfactory.py
parente543eada4e3d69d69ccaf16fb01d5afc712938e5 (diff)
activityfactory: Cope with dbus-python 0.82.2's fix to non-default timeouts. In 0.82.1 async call timeouts were wrongly in milliseconds, in >= 0.82.2 they are correctly in seconds. Synchronous timeouts have always been in seconds.
This patch can be simplified once dbus-python gets into builds (#3903).
Diffstat (limited to 'sugar/activity/activityfactory.py')
-rw-r--r--sugar/activity/activityfactory.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/sugar/activity/activityfactory.py b/sugar/activity/activityfactory.py
index 1041747..4143978 100644
--- a/sugar/activity/activityfactory.py
+++ b/sugar/activity/activityfactory.py
@@ -29,6 +29,13 @@ from sugar import util
import os
+# #3903 - this constant can be removed and assumed to be 1 when dbus-python
+# 0.82.3 is the only version used
+if dbus.version >= (0, 82, 3):
+ DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND = 1
+else:
+ DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND = 1000
+
_SHELL_SERVICE = "org.laptop.Shell"
_SHELL_PATH = "/org/laptop/Shell"
_SHELL_IFACE = "org.laptop.Shell"
@@ -143,7 +150,7 @@ class ActivityCreationHandler(gobject.GObject):
if not os.path.exists('/etc/olpc-security'):
handle = self._handle.get_dict()
self._factory.create(dbus.Dictionary(handle, signature='ss'),
- timeout=120 * 1000,
+ timeout=120 * DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND,
reply_handler=self._no_reply_handler,
error_handler=self._create_error_handler)
else:
@@ -153,7 +160,7 @@ class ActivityCreationHandler(gobject.GObject):
factory.CreateActivity(
self._service_name,
self._handle.get_dict(),
- timeout=120 * 1000,
+ timeout=120 * DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND,
reply_handler=self._create_reply_handler,
error_handler=self._create_error_handler,
dbus_interface=_RAINBOW_ACTIVITY_FACTORY_INTERFACE)