Skip to content

Commit

Permalink
In .patch serializer, default to "add" operation if no operation or n…
Browse files Browse the repository at this point in the history
…o target is given on the commandline. (#2898)
  • Loading branch information
ashleysommer authored Aug 27, 2024
1 parent 91f959a commit 6882f5f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rdflib/plugins/serializers/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def write_triples(contexts, op_code, use_passed_contexts=False):

if operation:
assert operation in add_remove_methods, f"Invalid operation: {operation}"

elif not target:
# No operation specified and no target specified
# Fall back to default operation of "add" to prevent a no-op
operation = "add"
write_header()
if operation:
operation_code = add_remove_methods.get(operation)
Expand Down

0 comments on commit 6882f5f

Please sign in to comment.