Prevent error on serializing book cover
This commit is contained in:
parent
b8e9f90138
commit
2cdd281e98
|
@ -61,6 +61,8 @@ class Book(ActivitypubMixin, BookWyrmModel):
|
||||||
@property
|
@property
|
||||||
def ap_cover(self):
|
def ap_cover(self):
|
||||||
''' an image attachment '''
|
''' an image attachment '''
|
||||||
|
if not self.cover or not hasattr(self.cover, 'url'):
|
||||||
|
return []
|
||||||
return [activitypub.Image(
|
return [activitypub.Image(
|
||||||
url='https://%s%s' % (DOMAIN, self.cover.url),
|
url='https://%s%s' % (DOMAIN, self.cover.url),
|
||||||
)]
|
)]
|
||||||
|
|
|
@ -72,7 +72,7 @@ class ImportItem(models.Model):
|
||||||
def get_book_from_isbn(self):
|
def get_book_from_isbn(self):
|
||||||
''' search by isbn '''
|
''' search by isbn '''
|
||||||
search_result = books_manager.first_search_result(
|
search_result = books_manager.first_search_result(
|
||||||
self.isbn, min_confidence=0.992
|
self.isbn, min_confidence=0.995
|
||||||
)
|
)
|
||||||
if search_result:
|
if search_result:
|
||||||
try:
|
try:
|
||||||
|
@ -90,7 +90,7 @@ class ImportItem(models.Model):
|
||||||
self.data['Author']
|
self.data['Author']
|
||||||
)
|
)
|
||||||
search_result = books_manager.first_search_result(
|
search_result = books_manager.first_search_result(
|
||||||
search_term, min_confidence=0.992
|
search_term, min_confidence=0.995
|
||||||
)
|
)
|
||||||
if search_result:
|
if search_result:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue