From 5dd75d0ea67b7c76a08d183400aa0fe03944b82b Mon Sep 17 00:00:00 2001 From: Kolenka Date: Mon, 4 Jun 2012 09:17:18 -0700 Subject: [PATCH] Fixes for handling of the cursor during collections writing. --- src/calibre/devices/prst1/driver.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/calibre/devices/prst1/driver.py b/src/calibre/devices/prst1/driver.py index f13c85b4c6..a2b6e3f63c 100644 --- a/src/calibre/devices/prst1/driver.py +++ b/src/calibre/devices/prst1/driver.py @@ -559,10 +559,10 @@ class PRST1(USBMS): def update_device_collections(self, connection, booklist, collections, source_id, dbpath): - cursor = connection.cursor() if collections: db_collections = self.read_device_collections(connection, source_id, dbpath) + cursor = connection.cursor() for collection, books in collections.items(): if collection not in db_collections: @@ -634,9 +634,8 @@ class PRST1(USBMS): cursor.execute(query, t) debug_print('Deleted Collection: ' + collection) - - connection.commit() - cursor.close() + connection.commit() + cursor.close() def rebuild_collections(self, booklist, oncard): debug_print('PRST1: starting rebuild_collections')