From b38e5996fbf0d8072245340124b4378bacb0edbd Mon Sep 17 00:00:00 2001 From: Josip Date: Sat, 8 Mar 2014 21:53:12 +0100 Subject: [PATCH] 7435: Media Editor error if Path value was changed to a non existing file fix media path --- gramps/gui/editors/editmedia.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gramps/gui/editors/editmedia.py b/gramps/gui/editors/editmedia.py index 00ca1c714..066dd2fbe 100644 --- a/gramps/gui/editors/editmedia.py +++ b/gramps/gui/editors/editmedia.py @@ -297,8 +297,12 @@ class EditMedia(EditPrimary): return path = self.file_path.get_text() - if os.path.isfile(path): - self.determine_mime() + ref_obj = self.dbstate.db.get_object_from_handle(self.obj.handle) + if ref_obj: + media_path = media_path_full(self.dbstate.db, + ref_obj.get_path()) + if os.path.exists(os.path.join(os.path.dirname(media_path), path)): + self.determine_mime() else: msg1 = _("There is no media matching the current path value!") msg2 = _("You have attempted to use the path with "