- if book.cover:
- cover = book.cover.url
- else:
- cover = None
- parent = book.parent_id
- parent_number = book.parent_number
- sort_key = book.sort_key
- size_str = pretty_size(html_file_size)
- authors = ", ".join(t.name for t in book.tags.filter(category='author'))
- db.execute(book_sql, locals())
+ db.execute(book_sql, {
+ 'title': book.title,
+ 'cover': book.cover.url if book.cover else None,
+ 'html_file': html_file,
+ 'html_file_size': html_file_size,
+ 'parent': book.parent_id,
+ 'parent_number': book.parent_number,
+ 'sort_key': book.sort_key,
+ 'size_str': pretty_size(html_file_size),
+ 'authors': book.author_unicode(),
+ })