Replace use of db.conn.close() as it is not supported in the new backend

This commit is contained in:
Kovid Goyal 2013-07-19 21:41:36 +05:30
parent e01a3a263d
commit 1770f6b1e9
5 changed files with 8 additions and 8 deletions

View File

@ -135,7 +135,7 @@ Various things that require other things before they can be migrated:
1. From initialize_dynamic(): Also add custom 1. From initialize_dynamic(): Also add custom
columns/categories/searches info into columns/categories/searches info into
self.field_metadata. self.field_metadata.
2. Port library/restore.py 2. Port library/restore.py, check_library.py and reinit_db() from debug.py
3. Check that content server reloading on metadata,db change, metadata 3. Check that content server reloading on metadata,db change, metadata
backup, refresh gui on calibredb add and moving libraries all work (check backup, refresh gui on calibredb add and moving libraries all work (check
them on windows as well for file locking issues) them on windows as well for file locking issues)

View File

@ -45,7 +45,7 @@ class DBCheck(QDialog): # {{{
self.user_version = self.db.user_version self.user_version = self.db.user_version
self.rejected = False self.rejected = False
self.db.clean() self.db.clean()
self.db.conn.close() self.db.close()
self.closed_orig_conn = True self.closed_orig_conn = True
t = DBThread(self.db.dbpath, False) t = DBThread(self.db.dbpath, False)
t.connect() t.connect()
@ -80,7 +80,7 @@ class DBCheck(QDialog): # {{{
self.pb.setMaximum(self.count) self.pb.setMaximum(self.count)
self.pb.setValue(0) self.pb.setValue(0)
self.msg.setText(_('Loading database from SQL')) self.msg.setText(_('Loading database from SQL'))
self.db.conn.close() self.db.close()
self.ndbpath = PersistentTemporaryFile('.db') self.ndbpath = PersistentTemporaryFile('.db')
self.ndbpath.close() self.ndbpath.close()
self.ndbpath = self.ndbpath.name self.ndbpath = self.ndbpath.name

View File

@ -103,7 +103,7 @@ def restore_database(db, parent=None):
'blank list of books.' 'blank list of books.'
'<p>Do you want to restore the database?')): '<p>Do you want to restore the database?')):
return False return False
db.conn.close() db.close()
d = DBRestore(parent, db.library_path) d = DBRestore(parent, db.library_path)
d.exec_() d.exec_()
r = d.restorer r = d.restorer

View File

@ -622,7 +622,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
if olddb is not None: if olddb is not None:
try: try:
if call_close: if call_close:
olddb.conn.close() olddb.close()
except: except:
import traceback import traceback
traceback.print_exc() traceback.print_exc()

View File

@ -130,7 +130,7 @@ class Restore(Thread):
restore_all_prefs=True, restore_all_prefs=True,
progress_callback=self.progress_callback) progress_callback=self.progress_callback)
db.commit() db.commit()
db.conn.close() db.close()
self.progress_callback(None, 1) self.progress_callback(None, 1)
if 'field_metadata' in prefs: if 'field_metadata' in prefs:
self.progress_callback(_('Finished restoring preferences and column metadata'), 1) self.progress_callback(_('Finished restoring preferences and column metadata'), 1)
@ -232,7 +232,7 @@ class Restore(Thread):
for i,args in enumerate(self.custom_columns.values()): for i,args in enumerate(self.custom_columns.values()):
db.create_custom_column(*args) db.create_custom_column(*args)
self.progress_callback(_('creating custom column ')+args[0], i+1) self.progress_callback(_('creating custom column ')+args[0], i+1)
db.conn.close() db.close()
def restore_books(self): def restore_books(self):
self.progress_callback(None, len(self.books)) self.progress_callback(None, len(self.books))
@ -252,7 +252,7 @@ class Restore(Thread):
db.conn.execute('UPDATE authors SET link=? WHERE name=?', db.conn.execute('UPDATE authors SET link=? WHERE name=?',
(link, author.replace(',', '|'))) (link, author.replace(',', '|')))
db.conn.commit() db.conn.commit()
db.conn.close() db.close()
def restore_book(self, book, db): def restore_book(self, book, db):
db.create_book_entry(book['mi'], add_duplicates=True, db.create_book_entry(book['mi'], add_duplicates=True,