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

Michael Stone michael at laptop.org
Sun Jun 13 20:49:56 EDT 2010


On Sun, Jun 13, 2010 at 08:43:19PM -0300, Andrés Ambrois wrote:
>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):
>                                                  file_path,
>                                                  transfer_ownership)
>     else:
>-        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')
> 
>-- 
>1.6.3.3

Reviewed-by: Michael Stone <michael at laptop.org>

Looks good to me; merged into my personal tree.

Michael


More information about the Sugar-devel mailing list