mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
fix missing types in BookData file fields
activitypub.BookData includes fields for 'files' and 'fileLinks'. This is a problem because BookData is inherited by Book and Author, neither of which have 'files' as a field in the main model. Additionally, Author doesn't have a value for 'file_links'. When serializing to JSON, BookData therefore throws 'TypeError: Object of type _MISSING_TYPE is not JSON serializable' This fixes the problem by removing links and moving fileLinks to activitypub.Book.
This commit is contained in:
parent
ee88c3b914
commit
2248206a66
1 changed files with 2 additions and 2 deletions
|
@ -22,8 +22,6 @@ class BookData(ActivityObject):
|
|||
aasin: Optional[str] = None
|
||||
isfdb: Optional[str] = None
|
||||
lastEditedBy: Optional[str] = None
|
||||
links: list[str] = field(default_factory=list)
|
||||
fileLinks: list[str] = field(default_factory=list)
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
|
@ -45,6 +43,8 @@ class Book(BookData):
|
|||
firstPublishedDate: str = ""
|
||||
publishedDate: str = ""
|
||||
|
||||
fileLinks: list[str] = field(default_factory=list)
|
||||
|
||||
cover: Optional[Document] = None
|
||||
type: str = "Book"
|
||||
|
||||
|
|
Loading…
Reference in a new issue