Handle both Image and Document types

This commit is contained in:
Mouse Reeve 2021-04-17 11:47:48 -07:00
parent 239d927e94
commit 7c85b554cf
3 changed files with 9 additions and 4 deletions

View file

@ -5,7 +5,7 @@ import sys
from .base_activity import ActivityEncoder, Signature, naive_parse
from .base_activity import Link, Mention
from .base_activity import ActivitySerializerError, resolve_remote_id
from .image import Document
from .image import Document, Image
from .note import Note, GeneratedNote, Article, Comment, Quotation
from .note import Review, Rating
from .note import Tombstone

View file

@ -5,9 +5,14 @@ from .base_activity import ActivityObject
@dataclass(init=False)
class Document(ActivityObject):
""" image block """
""" a document """
url: str
name: str = ""
type: str = "Document"
id: str = None
@dataclass(init=False)
class Image(Document):
""" an image """
type: str = "Image"

View file

@ -3,7 +3,7 @@ from dataclasses import dataclass, field
from typing import Dict
from .base_activity import ActivityObject
from .image import Document
from .image import Image
@dataclass(init=False)
@ -28,7 +28,7 @@ class Person(ActivityObject):
endpoints: Dict = None
name: str = None
summary: str = None
icon: Document = field(default_factory=lambda: {})
icon: Image = field(default_factory=lambda: {})
bookwyrmUser: bool = False
manuallyApprovesFollowers: str = False
discoverable: str = False