← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~j-corwin/openlp/bug-1027254 into lp:openlp

 

Jonathan Corwin has proposed merging lp:~j-corwin/openlp/bug-1027254 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~j-corwin/openlp/bug-1027254/+merge/122770

After a bit of trial and error, I came up with the following changes which fixes the file locking problem in bug 1027254 (for me at least).

However I'm a bit unsure if there was a good reason why it was looping through the files before...
-- 
https://code.launchpad.net/~j-corwin/openlp/bug-1027254/+merge/122770
Your team OpenLP Core is requested to review the proposed merge of lp:~j-corwin/openlp/bug-1027254 into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2012-06-22 14:14:53 +0000
+++ openlp/plugins/bibles/lib/manager.py	2012-09-04 22:45:23 +0000
@@ -208,24 +208,16 @@
 
     def delete_bible(self, name):
         """
-        Delete a bible completly.
+        Delete a bible completely.
 
         ``name``
             The name of the bible.
         """
         log.debug(u'BibleManager.delete_bible("%s")', name)
-        files = SettingsManager.get_files(self.settingsSection,
-            self.suffix)
-        if u'alternative_book_names.sqlite' in files:
-            files.remove(u'alternative_book_names.sqlite')
-        for filename in files:
-            bible = BibleDB(self.parent, path=self.path, file=filename)
-            # Remove the bible files
-            if name == bible.get_name():
-                bible.session.close()
-                if delete_file(os.path.join(self.path, filename)):
-                    return True
-        return False
+        bible = self.db_cache[name]
+        bible.session.close()
+        bible.session = None
+        return delete_file(os.path.join(bible.path, bible.file))
 
     def get_bibles(self):
         """


Follow ups