[Sugar-devel] [PATCH sugar] Raise alert when trying to send an entry without an associated file OLPC #10798

Simon Schampijer simon at schampijer.de
Wed May 25 12:30:45 EDT 2011


We raise the same error when we try to copy an entry without an
associated file to an external device.

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/jarabe/journal/palettes.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/palettes.py b/src/jarabe/journal/palettes.py
index 0b3f7d2..032f63f 100644
--- a/src/jarabe/journal/palettes.py
+++ b/src/jarabe/journal/palettes.py
@@ -136,6 +136,13 @@ class ObjectPalette(Palette):
         logging.debug('__friend_selected_cb')
         file_name = model.get_file(self._metadata['uid'])
 
+        if not file_name or not os.path.exists(file_name):
+            logging.warn('Entries without a file cannot be sent.')
+            self.emit('volume-error',
+                      _('Entries without a file cannot be sent.'),
+                      _('Warning'))
+            return
+
         title = str(self._metadata['title'])
         description = str(self._metadata.get('description', ''))
         mime_type = str(self._metadata['mime_type'])
-- 
1.7.4



More information about the Sugar-devel mailing list