From 58695ac6f62cc07cc2ba34775d97d53e61014420 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 21 Sep 2011 18:23:04 +0100 Subject: [PATCH 1/2] Change None to u'' for printing Fixes: https://launchpad.net/bugs/855368 --- openlp/core/lib/serviceitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 05a1128b1..3170e0a93 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -466,7 +466,7 @@ class ServiceItem(object): 'Length: %s')) % \ unicode(datetime.timedelta(seconds=self.media_length)) if not start and not end: - return None + return u'' elif start and not end: return start elif not start and end: From e3ecee8ae5a9f38a8a809f15d9fd0181deea1161 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 21 Sep 2011 22:47:30 +0200 Subject: [PATCH 2/2] Fixed bug #855342 where saving an already-saved service file with an audio file in it caused an exception. Fixes: https://launchpad.net/bugs/855342 --- openlp/core/ui/servicemanager.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index d2d7450ca..c6ffaaccc 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -554,6 +554,18 @@ class ServiceManager(QtGui.QWidget): for path_from in write_list: zip.write(path_from, path_from.encode(u'utf-8')) for path_from, path_to in audio_files: + if path_from == path_to: + # If this file has already been saved, let's use set the + # from path to the real location of the files + path_from = os.path.join(self.servicePath, path_from) + else: + # If this file has not yet been saved, let's copy the file + # to the service manager path + save_file = os.path.join(self.servicePath, path_to) + save_path = os.path.split(save_file)[0] + if not os.path.exists(save_path): + os.makedirs(save_path) + shutil.copy(path_from, save_file) zip.write(path_from, path_to.encode(u'utf-8')) except IOError: log.exception(u'Failed to save service to disk')