Remove corrupted bible databases when loading bibles.

bzr-revno: 1384
This commit is contained in:
Andreas Preikschat 2011-03-13 19:10:58 +01:00
commit 2ec473d55e
1 changed files with 6 additions and 2 deletions

View File

@ -25,14 +25,14 @@
###############################################################################
import logging
import os
from PyQt4 import QtCore
from openlp.core.lib import Receiver, SettingsManager, translate
from openlp.core.utils import AppLocation
from openlp.core.utils import AppLocation, delete_file
from openlp.plugins.bibles.lib import parse_reference
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
from csvbible import CSVBible
from http import HTTPBible
from opensong import OpenSongBible
@ -144,6 +144,10 @@ class BibleManager(object):
for filename in files:
bible = BibleDB(self.parent, path=self.path, file=filename)
name = bible.get_name()
# Remove corrupted files.
if name is None:
delete_file(os.path.join(self.path, filename))
continue
log.debug(u'Bible Name: "%s"', name)
self.db_cache[name] = bible
# Look to see if lazy load bible exists and get create getter.