$def with (page, editions_page=False, render_times={}) $if page.type.key == '/type/work' and page.edition_count == 1: $ edit_url = page.editions[0].key + '?m=edit' $elif page.type.key in ["/type/work", "/type/edition", "/type/author"]: $ edit_url = page.url(suffix="/edit") $else: $ edit_url = page.key + "?m=edit" $ viewbook = "//%s/stream/XXX?ref=ol" % bookreader_host() $ prices = page.key.startswith('/books/') $ oclc_numbers = (page.oclc_numbers and page.oclc_numbers[0]) or "" $ isbn_13 = page.get_isbn13() $ isbn_10 = page.get_isbn10() $ asin = None $if page.get('identifiers'): $if page.identifiers.get('amazon'): $ asin = page.identifiers.amazon[0] $if isbn_10 and not asin: $ asin = isbn_10
$_('Buy this book')
$ render_times['databarWork: AffiliateLinks'] = time() $:macros.AffiliateLinks(page, {'isbn': isbn_13, 'asin': asin, 'prices': prices}) $ render_times['databarWork: AffiliateLinks'] = time() - render_times['databarWork: AffiliateLinks']$edition.sponsorship_data.donor_msg