tsyesika/PyPump

.to and .cc always return empty list

Closed this issue · 6 comments

When you are using an object such as a note or a image which give the ability to set to/cc/bcc/etc. there is a corresponding .to/.cc/etc. property on the object. This seems to return an empty list even if it does in fact have some lists/people it was sent to.

Example:

>>> note = me.inbox[0].obj
>>> note
<Note by PyPumpTest@microca.st>
>>> note.cc # This should have a list with 1 element - the special group "Followers"
[]
>>>

Okay it seems we're trying to relay on setting them on the Activity object rather than the object itself. Apparently the notes sometimes don't have to/cc/etc. set (such as inReplyTo/favourites/etc.) so we shouldn't relay on those.

Currently our solution due to it being dynamically set sometimes they're not being set on activity if the value would be empty, this should in-fact be an empty list.

My proposal is that:

  1. We confirm and inform Evan that there is a problem with to/cc/etc. on notes in inReplyTo/favourites/etc.
  2. We remove activity.to/activity.cc/etc.
  3. We keep the to/cc/bcc/bto/etc. properties on the actual object but figure out how to look them up in a reliable way.
  1. not yet done
  2. recipients now set for Postable objects when we can get them (f.ex in inbox)

Changed behaviour: Postable.to/cc/etc have lists of pump objects instead of dicts

I think we should hold off on 2) until we have a way to view/set recipients on all objects

Hm. I wonder if this is related to these changes, but in current git master, not even that works:

In [30]: pump.me.inbox[0].to
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/cwebber/devel/pypump/pypump-shell in <module>()
----> 1 pump.me.inbox[0].to

AttributeError: 'Activity' object has no attribute 'to'

In a510b49 this was fine:

In [1]: pump.me.inbox[0].to
Out[1]: [<Collection: http://activityschema.org/collection/public>]

All those attributes can now be found on pump.me.inbox[0].obj (where it appears to be working)

This still needs documenting - maybe we should do release notes too for people upgrading from previous versions?

Recipient properties (.to, .cc, .bto, .bcc) has been moved from Activity to Activity.obj

added to 0.6 changelog.

Is this the behavior we want or would it be better to have recipients on both Activity and Activity.obj?