openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #09966
[Merge] lp:~smpettit/openlp/bug-793522 into lp:openlp
Stevan Pettit has proposed merging lp:~smpettit/openlp/bug-793522 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~smpettit/openlp/bug-793522/+merge/64087
Fixed bug 793552.
Added code to openlp/plugins/bibles/lib/manager.py to skip old_databases during load. (Would we want to delete them)?
Added a routine to openlp/plugins/bibles/lib/db.py to close the DB "Cursor" and "Connection"
Added code to openlp/plugins/bibles/forms/bibleupgradeform.py to "close" the DB so the old DB file can be deleted afrter use.
--
https://code.launchpad.net/~smpettit/openlp/bug-793522/+merge/64087
Your team OpenLP Core is requested to review the proposed merge of lp:~smpettit/openlp/bug-793522 into lp:openlp.
=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py 2011-06-05 17:39:13 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py 2011-06-09 21:31:57 +0000
@@ -732,6 +732,7 @@
self.newbibles[number].session.commit()
if not bible_failed:
self.newbibles[number].create_meta(u'Version', name)
+ oldbible.close_connection()
delete_file(os.path.join(self.path, filename[0]))
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2011-06-04 13:52:26 +0000
+++ openlp/plugins/bibles/lib/db.py 2011-06-09 21:31:57 +0000
@@ -1101,3 +1101,7 @@
]
else:
return None
+
+ def close_connection(self):
+ self.cursor.close()
+ self.connection.close()
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py 2011-05-29 19:32:37 +0000
+++ openlp/plugins/bibles/lib/manager.py 2011-06-09 21:31:57 +0000
@@ -147,33 +147,34 @@
self.db_cache = {}
self.old_bible_databases = []
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
- # Find old database versions
- if bible.is_old_database():
- self.old_bible_databases.append([filename, name])
- bible.session.close()
- 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.
- source = self.db_cache[name].get_object(BibleMeta,
- u'download source')
- if source:
- download_name = self.db_cache[name].get_object(BibleMeta,
- u'download name').value
- meta_proxy = self.db_cache[name].get_object(BibleMeta,
- u'proxy url')
- web_bible = HTTPBible(self.parent, path=self.path,
- file=filename, download_source=source.value,
- download_name=download_name)
- if meta_proxy:
- web_bible.proxy_server = meta_proxy.value
- self.db_cache[name] = web_bible
+ if not filename.startswith(u'old_database_'):
+ 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
+ # Find old database versions
+ if bible.is_old_database():
+ self.old_bible_databases.append([filename, name])
+ bible.session.close()
+ 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.
+ source = self.db_cache[name].get_object(BibleMeta,
+ u'download source')
+ if source:
+ download_name = self.db_cache[name].get_object(BibleMeta,
+ u'download name').value
+ meta_proxy = self.db_cache[name].get_object(BibleMeta,
+ u'proxy url')
+ web_bible = HTTPBible(self.parent, path=self.path,
+ file=filename, download_source=source.value,
+ download_name=download_name)
+ if meta_proxy:
+ web_bible.proxy_server = meta_proxy.value
+ self.db_cache[name] = web_bible
log.debug(u'Bibles reloaded')
def set_process_dialog(self, wizard):
Follow ups