From 95915ef9a9fbfd928469818c2d8cf2e502325226 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 8 Apr 2019 20:31:26 +0200 Subject: Improved naive ActivityStream object --- pyapd/objects.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/pyapd/objects.py b/pyapd/objects.py index 19aa65f..4a97200 100644 --- a/pyapd/objects.py +++ b/pyapd/objects.py @@ -5,13 +5,42 @@ class ActivityObject(): PROPERTIES = [ 'id', 'type', + 'attachment', + 'attributedTo', + 'audience', + 'content', + 'context', + 'contentMap', + 'name', + 'nameMap', + 'endTime', + 'generator', + 'icon', + 'image', + 'inReplyTo', + 'location', + 'preview', + 'published', + 'replies', + 'startTime', + 'summary', + 'summaryMap', + 'tag', + 'updated', + 'url', + 'to', + 'bto', + 'cc', + 'bcc', + 'mediaType', + 'duration', ] def __init__(self, *args, **kw): self.context = "https://www.w3.org/ns/activitystreams" for p in self.PROPERTIES: if p in kw: - setattr(self, p, kw[p]) + setattr(self, "ap_"+p, kw[p]) @classmethod def from_jsons(cls, data: str): @@ -20,7 +49,7 @@ class ActivityObject(): def to_jsonable(self): data = {} for p in self.PROPERTIES: - v = getattr(self, p, None) + v = getattr(self, "ap_"+p, None) if v is not None: data[p] = v return data -- cgit v1.2.3