Skip to content

Commit

Permalink
Protocol.receive: switch from Object.get_or_create blind put
Browse files Browse the repository at this point in the history
shouldn't overwrite because we already check that we haven't seen the id before

for #1360
  • Loading branch information
snarfed committed Jan 20, 2025
1 parent 5603e46 commit 0484570
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,11 +961,7 @@ def receive(from_cls, obj, authed_as=None, internal=False, received_at=None):
# write Object to datastore
obj.source_protocol = from_cls.LABEL
if obj.type in STORE_AS1_TYPES:
# this is a new activity, it shouldn't have any copies yet, but check to
# be sure, since Object.to_dict flattens StructuredProperties so they
# won't work when passed to the Object constructor as kwargs
assert not obj.copies
obj = Object.get_or_create(id, authed_as=actor, **obj.to_dict())
obj.put()

# store inner object
# TODO: unify with big obj.type conditional below. would have to merge
Expand Down

0 comments on commit 0484570

Please sign in to comment.