foxhole/app/ap_object.py

18 lines
384 B
Python

#!/usr/bin/env python3
from app import activitypub as ap
from functools import cached_property
class BaseObject:
@property
def ap_object(self) -> ap.RawObject:
raise NotImplementedError
@cached_property
def content(self) -> str | None:
content = self.ap_object.get("content")
if not content:
return None
return content