foxhole/app/ap_object.py

19 lines
384 B
Python
Raw Normal View History

2023-07-30 14:48:50 +02:00
#!/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