mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
calibredb list: Fix error if one of the requested fields if empty for all requested books
This commit is contained in:
parent
3ff7f39b4b
commit
2e608ed179
@ -131,11 +131,11 @@ def do_list(db, fields, afields, sort_by, ascending, search_text, line_width, se
|
|||||||
with ColoredStream(sys.stdout, fg='green'):
|
with ColoredStream(sys.stdout, fg='green'):
|
||||||
print ''.join(titles)
|
print ''.join(titles)
|
||||||
|
|
||||||
wrappers = map(lambda x: TextWrapper(x-1), widths)
|
wrappers = [TextWrapper(x - 1).wrap if x > 1 else lambda y: y for x in widths]
|
||||||
o = cStringIO.StringIO()
|
o = cStringIO.StringIO()
|
||||||
|
|
||||||
for record in data:
|
for record in data:
|
||||||
text = [wrappers[i].wrap(unicode(record[field])) for i, field in enumerate(fields)]
|
text = [wrappers[i](unicode(record[field])) for i, field in enumerate(fields)]
|
||||||
lines = max(map(len, text))
|
lines = max(map(len, text))
|
||||||
for l in range(lines):
|
for l in range(lines):
|
||||||
for i, field in enumerate(text):
|
for i, field in enumerate(text):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user