Skip old-database's during bible loading

This commit is contained in:
Stevan Pettit 2011-06-09 11:26:13 -04:00
parent c6166453bb
commit 1bdfd60d52

View File

@ -147,33 +147,34 @@ class BibleManager(object):
self.db_cache = {} self.db_cache = {}
self.old_bible_databases = [] self.old_bible_databases = []
for filename in files: for filename in files:
bible = BibleDB(self.parent, path=self.path, file=filename) if not filename.startswith(u'old_database_'):
name = bible.get_name() bible = BibleDB(self.parent, path=self.path, file=filename)
# Remove corrupted files. name = bible.get_name()
if name is None: # Remove corrupted files.
delete_file(os.path.join(self.path, filename)) if name is None:
continue delete_file(os.path.join(self.path, filename))
# Find old database versions continue
if bible.is_old_database(): # Find old database versions
self.old_bible_databases.append([filename, name]) if bible.is_old_database():
bible.session.close() self.old_bible_databases.append([filename, name])
continue bible.session.close()
log.debug(u'Bible Name: "%s"', name) continue
self.db_cache[name] = bible log.debug(u'Bible Name: "%s"', name)
# Look to see if lazy load bible exists and get create getter. self.db_cache[name] = bible
source = self.db_cache[name].get_object(BibleMeta, # Look to see if lazy load bible exists and get create getter.
u'download source') source = self.db_cache[name].get_object(BibleMeta,
if source: u'download source')
download_name = self.db_cache[name].get_object(BibleMeta, if source:
u'download name').value download_name = self.db_cache[name].get_object(BibleMeta,
meta_proxy = self.db_cache[name].get_object(BibleMeta, u'download name').value
u'proxy url') meta_proxy = self.db_cache[name].get_object(BibleMeta,
web_bible = HTTPBible(self.parent, path=self.path, u'proxy url')
file=filename, download_source=source.value, web_bible = HTTPBible(self.parent, path=self.path,
download_name=download_name) file=filename, download_source=source.value,
if meta_proxy: download_name=download_name)
web_bible.proxy_server = meta_proxy.value if meta_proxy:
self.db_cache[name] = web_bible web_bible.proxy_server = meta_proxy.value
self.db_cache[name] = web_bible
log.debug(u'Bibles reloaded') log.debug(u'Bibles reloaded')
def set_process_dialog(self, wizard): def set_process_dialog(self, wizard):