From 9dfa3f89dbcb3ed70de990e7784538d5bc8ecc42 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 30 Dec 2021 17:30:42 +0530 Subject: [PATCH] calibredb catalog: Fix --ids and --search options not working for cvx/xml catalogs. Fixes #1955967 ['calibredb catalog' options broken: --ids and --search](https://bugs.launchpad.net/calibre/+bug/1955967) --- src/calibre/customize/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index 76aae05515..cb1296eabd 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -512,7 +512,7 @@ class CatalogPlugin(Plugin): # {{{ db.search(opts.search_text) - if opts.sort_by: + if getattr(opts, 'sort_by', None): # 2nd arg = ascending db.sort(opts.sort_by, True) return db.get_data_as_dict(ids=opts.ids) @@ -530,7 +530,7 @@ class CatalogPlugin(Plugin): # {{{ all_custom_fields.add(field+'_index') all_fields = all_std_fields.union(all_custom_fields) - if opts.fields != 'all': + if getattr(opts, 'fields', 'all') != 'all': # Make a list from opts.fields of = [x.strip() for x in opts.fields.split(',')] requested_fields = set(of)