[Sugar-devel] [PATCH] Wrong exception when copying an entry with no file to a removable device.

Andrés Ambrois andresambrois at gmail.com
Sun Jun 13 19:43:19 EDT 2010

In that case write() was called with file_path=None by copy() and a
TypeError was raised by os.path.exists().

Signed-off-by: Andrés Ambrois <andresambrois at gmail.com>
 src/jarabe/journal/model.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index ae77e72..fd3d3db 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -492,7 +492,7 @@ def write(metadata, file_path='', update_mtime=True, transfer_ownership=True):
-        if not os.path.exists(file_path):
+        if not file_path or not os.path.exists(file_path):
             raise ValueError('Entries without a file cannot be copied to '
                              'removable devices')

More information about the Sugar-devel mailing list