diff options
Diffstat (limited to 'src/sugar/activity/activityfactory.py')
-rw-r--r-- | src/sugar/activity/activityfactory.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py index 58de117..7cba1d6 100644 --- a/src/sugar/activity/activityfactory.py +++ b/src/sugar/activity/activityfactory.py @@ -123,7 +123,7 @@ def get_environment(activity): return environ -def get_command(activity, activity_id=None, tree_id=None, version_id=None, uri=None): +def get_command(activity, activity_id=None, object_id=None, uri=None): if not activity_id: activity_id = create_activity_id() @@ -131,9 +131,9 @@ def get_command(activity, activity_id=None, tree_id=None, version_id=None, uri=N command.extend(['-b', activity.get_bundle_id()]) command.extend(['-a', activity_id]) - if tree_id is not None: - command.extend(['-o', tree_id]) - if version_id is not None: + if object_id is not None: + tree_id, version_id = object_id + command.extend(['-t', tree_id]) command.extend(['-r', version_id]) if uri is not None: command.extend(['-u', uri]) @@ -222,7 +222,7 @@ class ActivityCreationHandler(gobject.GObject): self._shell = dbus.Interface(bus_object, _SHELL_IFACE) if handle.activity_id is not None and \ - handle.tree_id is None: + handle.object_id is None: datastore = dbus.Interface( bus.get_object(_DS_SERVICE, _DS_PATH), _DS_INTERFACE) datastore.find({ 'activity_id': self._handle.activity_id }, [], @@ -252,8 +252,7 @@ class ActivityCreationHandler(gobject.GObject): environ = get_environment(self._bundle) (log_path, log_file) = open_log_file(self._bundle) command = get_command(self._bundle, self._handle.activity_id, - self._handle.tree_id, - self._handle.version_id, + self._handle.object_id, self._handle.uri) if not self._use_rainbow: @@ -321,9 +320,8 @@ class ActivityCreationHandler(gobject.GObject): def _find_object_reply_handler(self, jobjects, count): if count > 0: if count > 1: - logging.debug("Multiple objects has the same activity_id.") - self._handle.tree_id = jobjects[0]['tree_id'] - self._handle.version_id = jobjects[0]['version_id'] + logging.debug("Multiple objects have the same activity_id.") + self._handle.object_id = (jobjects[0]['tree_id'], jobjects[0]['version_id']) self._launch_activity() def _find_object_error_handler(self, err): @@ -341,7 +339,8 @@ def create_with_uri(bundle, uri): activity_handle = ActivityHandle(uri=uri) return ActivityCreationHandler(bundle, activity_handle) -def create_with_tree_id(bundle, tree_id, version_id): +def create_with_object_id(bundle, object_id): """Create a new activity and pass both the tree id and the version id as handle.""" + tree_id, version_id = object_id activity_handle = ActivityHandle(tree_id=tree_id, version_id=version_id) return ActivityCreationHandler(bundle, activity_handle) |