From 712e082dc442fb1ad365dc19fafb52fb524a288c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 24 Oct 2009 14:42:02 -0600 Subject: [PATCH] Fix #3856 (Error message when Kindle 2 is attached) --- src/calibre/gui2/device.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index ec1f8984e2..b03101b23e 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -680,11 +680,13 @@ class DeviceGUI(object): auto = [] if do_auto_convert and _auto_ids: for id in _auto_ids: - formats = [f.lower() for f in self.library_view.model().db.formats(id, index_is_id=True).split(',')] - formats = formats if formats != None else [] - if list(set(formats).intersection(available_input_formats())) != [] and list(set(self.device_manager.device_class.settings().format_map).intersection(available_output_formats())) != []: + dbfmts = self.library_view.model().db.formats(id, index_is_id=True) + formats = [] if dbfmts is None else \ + [f.lower() for f in dbfmts.split(',')] + if set(formats).intersection(available_input_formats()) \ + and set(self.device_manager.device_class.settings().format_map).intersection(available_output_formats()): auto.append(id) - if auto != []: + if auto: format = None for fmt in self.device_manager.device_class.settings().format_map: if fmt in list(set(self.device_manager.device_class.settings().format_map).intersection(set(available_output_formats()))):