Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2021-08-20 14:15:46 -07:00
commit 1d6f30c2df

View file

@ -56,6 +56,8 @@ def truncatepath(value, arg):
@register.simple_tag(takes_context=False)
def get_book_cover_thumbnail(book, size="medium", ext="jpg"):
"""Returns a book thumbnail at the specified size and extension, with fallback if needed"""
if size == "":
size = "medium"
try:
cover_thumbnail = getattr(book, "cover_bw_book_%s_%s" % (size, ext))
return cover_thumbnail.url