From ace5e73d3d4a7a6b5fe601e0acfd566bf26b6281 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 5 Feb 2009 12:43:50 +0100 Subject: [PATCH] Don't push to the DS a file path pointing to nowhere #258 --- src/sugar/activity/activity.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 5f15876d..66dcbd1e 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -774,14 +774,16 @@ class Activity(Window, gtk.Container): if preview is not None: self.metadata['preview'] = dbus.ByteArray(preview) + file_path = os.path.join(self.get_activity_root(), 'instance', + '%i' % time.time()) try: - file_path = os.path.join(self.get_activity_root(), 'instance', - '%i' % time.time()) self.write_file(file_path) - self._owns_file = True - self._jobject.file_path = file_path except NotImplementedError: logging.debug('Activity.write_file is not implemented.') + else: + if os.path.exists(file_path): + self._owns_file = True + self._jobject.file_path = file_path # Cannot call datastore.write async for creates: # https://dev.laptop.org/ticket/3071