← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/bug-851653 into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-851653 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #851653 in OpenLP: "Cannot delete songs"
  https://bugs.launchpad.net/openlp/+bug/851653

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-851653/+merge/75684

Fixed bug #851653, where deleting a song without audio files raised an exception.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bug-851653/+merge/75684
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-851653 into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2011-09-12 17:09:11 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2011-09-16 08:40:15 +0000
@@ -399,8 +399,10 @@
                     except:
                         log.exception('Could not remove file: %s', audio)
                 try:
-                    os.rmdir(os.path.join(AppLocation.get_section_data_path(
-                        self.plugin.name), 'audio', str(item_id)))
+                    save_path = os.path.join(AppLocation.get_section_data_path(
+                        self.plugin.name), 'audio', str(item_id))
+                    if os.path.exists(save_path):
+                        os.rmdir(save_path)
                 except OSError:
                     log.exception(u'Could not remove directory: %s', save_path)
                 self.plugin.manager.delete_object(Song, item_id)


Follow ups