From 9985b876b223f0d3769ac3cff0c92147a1088cac Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Tue, 4 Sep 2012 23:39:47 +0100 Subject: [PATCH] Rework code to prevent file lock --- openlp/plugins/bibles/lib/manager.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 530ab4f09..66e0d93bc 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -208,24 +208,16 @@ class BibleManager(object): 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): """