$def with (work, editions=None, edition=None, editions_limit=None) $ book_keys = [] $ edition_list_start = time() $if editions_limit or (len(editions) < work.edition_count): $if editions and len(editions): $ editions = editions or work.get_sorted_editions() $ index_padding = len(str(len(editions))) $for book in editions: $ book_keys.append(book['key'].replace('/books/', '')) $ edition_sort_key = str(loop.index0+1).zfill(index_padding) $if book.key == edition.key: $# This enables us to always render a select edition first in the table (default) $:render_template("books/edition-sort", book, edition_sort_key, render_first=True) $else: $:render_template("books/edition-sort", book, edition_sort_key)
$_('Edition') $_('Availability')
$else:

$_('No editions available')

$ edition_list_secs = time() - edition_list_start

$_("Add another edition?")

$if ctx.user and ctx.user.is_admin() and query_param('debug'):
Getting list of editions took $("%.2f" % edition_list_secs) seconds