mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Add useful reprs to books & search results for debugging.
This commit is contained in:
parent
03a71b1c37
commit
8fb082e2fc
2 changed files with 8 additions and 1 deletions
|
@ -53,8 +53,12 @@ class AbstractConnector(ABC):
|
|||
|
||||
class SearchResult(object):
|
||||
''' standardized search result object '''
|
||||
def __init__(self, title, key, author, year):
|
||||
def __init__(self, title, key, author, year, raw_data):
|
||||
self.title = title
|
||||
self.key = key
|
||||
self.author = author
|
||||
self.year = year
|
||||
self.raw_data = raw_data
|
||||
|
||||
def __repr__(self):
|
||||
return "<SearchResult key={!r} title={!r} author={!r}>".format(self.key, self.title, self.author)
|
||||
|
|
|
@ -54,6 +54,9 @@ class Book(FedireadsModel):
|
|||
model_name = type(self).__name__.lower()
|
||||
return '%s/%s/%s' % (base_path, model_name, self.openlibrary_key)
|
||||
|
||||
def __repr__(self):
|
||||
return "<{} key={!r} title={!r} author={!r}>".format(self.__class__, self.openlibrary_key, self.title, self.author)
|
||||
|
||||
|
||||
class Work(Book):
|
||||
''' a work (an abstract concept of a book that manifests in an edition) '''
|
||||
|
|
Loading…
Reference in a new issue