Skip to content

Commit

Permalink
In relation.create, handle existing value of None
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Apr 29, 2024
1 parent f2ac29a commit 063f163
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plone/api/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def create(source=None, target=None, relationship=None):
target.absolute_url(),
)
if not has_relation:
existing_relations = getattr(source, from_attribute, [])
existing_relations = getattr(source, from_attribute, None) or []
existing_relations.append(RelationValue(to_id))
setattr(source, from_attribute, existing_relations)
modified(source)
Expand Down

0 comments on commit 063f163

Please sign in to comment.